You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When an argument of the wrong type is passed to a Pyccel function the
following error is raised:
```
TypeError: Expected an argument of type int32[:] for argument x
```
for an array this error is not very detailed as it does not specify if
the problem is due to the rank, the data type, or the order. The error
message containing these details is actually set in `pyarray_check`,
however the error is overwritten by the code in the cwrapper (which is
added to also raise errors for other types, e.g scalars). The only
additional information in the error message is the name of the variable
which has the incorrect type.
This PR adds the name as an argument to the function `pyarray_check` and
stops the wrapper from overwriting the generated error message. The
error message is now:
```
TypeError: Wrong argument type for argument x : argument dtype must be Int32, not Int64, argument rank must be 2, not 3, argument does not have the expected ordering (C)
```
**Commit Summary**
- Add the `name` argument to `pyarray_check`
- Allow the use of a `LiteralString` as a `char*` argument in the C
wrapper
- Stop overwriting the `PyErr` string if the type check is carried out
for an ND array
0 commit comments