-
-
Notifications
You must be signed in to change notification settings - Fork 12.3k
BUG,ENH: cython stubs should use except (0|-1?) etc. for integer returning functions #19291
Copy link
Copy link
Closed
Labels
00 - BugProjectPossible project, may require specific skills and long commitmentPossible project, may require specific skills and long commitment
Description
According to the docs PyArray_IntpConverter is supposed to just return NPY_FAIL (0) on failure and NPY_SUCCESS (1) otherwise. So to help manually raise an exception I write something like:
cdef np.PyArray_Dims shape
if not np.PyArray_IntpConverter(size, &shape):
raise ValueError("`size` is not a valid argument.")But this ends up raising a SystemError with the message: <class 'ValueError'> returned a result with an error set, Which ends up causing unittests to fail since the intended ValueError is not raised.
Reproducing code example:
Passing a set for size instead of the expected tuple.
Is there a way to silence the SystemError and only raise the intended one?
NumPy/Python version information:
1.19.0 3.6.12 (default, May 11 2021, 17:48:34)
[GCC 10.2.0]
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
00 - BugProjectPossible project, may require specific skills and long commitmentPossible project, may require specific skills and long commitment