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
$ python3 test.py
1
(0,2)
TypeError: can't convert complex to int
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "test.py", line 4, in <module>
test.test(2j)
SystemError: <built-in method test of PyCapsule object at 0x7fba58d193c0> returned a result with an error set
Suggested solution
In cast.h, line 453, it can happen that PyNumber_Long fails. In this case it leaves an unhandled TypeError.
Since commit 496feac
the following code executes the right function but quits with an unhandled exception.
Failing code
test.cpp
test.py
The output:
Suggested solution
In cast.h, line 453, it can happen that
PyNumber_Long
fails. In this case it leaves an unhandledTypeError
.My suggestion is to call PyErr_Clear() again after trying the conversion:
The text was updated successfully, but these errors were encountered: