-
-
Notifications
You must be signed in to change notification settings - Fork 11k
SystemError on invalid ndarray / Path operation #7360
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Looks like a
Compared with what happens when dividing with a string:
So Python bug, hence close this issue? |
TypeError is not a bug. SystemError is a bug. And this looks as NumPy bug. I can't reproduce the bug on 32-bit Python 3.4.3 with NumPy 1.8.2. |
Traceback:
|
iterator_loop() calls PyUFunc_OO_O() which calls Path.rtruediv() which raises an error, but it doesn't handle immediatly the error: it continue to call PyUFunc_OO_O() with an exception set. Python 3.5 helps to detect bugs in C code, it is now more strict. It's not more possible to call arbitrary Python function with an exception set. You have two main choices:
It's up to you to decide how to handle this case. I modified Python 3.5 to make it more strict to avoid loosing exceptions by mistake. For example, calling hasattr() can clear the current exception. So if you call hasattr() while you handle an exception, you may simply loose the current exception. It may work or not. Python 3.5 now requires to be more careful. |
The threshold is going to be the iterator buffer size (8196 elements I think). Though it surprises me that it should be different if one loop or more loops are called. Maybe we don't check the error state after every loop but only at the very end. We will have to check. |
It looks to me like this got fixed. On windows 10 with a recent master, I get only the |
I still get the error with Py3.8.6/numpy 1.19.2... |
This sounds like the type of thing that @seberg may have fixed after 1.19 was released. |
Milestoning and reopening so we remember to test this. |
Probably fixed (or at least mostly fixed) by gh-17029. To be fair, that does include a few new tests which may already cover this one (I am not certain). |
I cannot reproduce on master with Python 3.9.
|
Indeed, seems fixed on master. |
Running
raises
Note that this does NOT appear for small arrays; I haven't determined the threshold.
Crossposted as http://bugs.python.org/issue26453.
Python 3.5.1, numpy 1.10.4.
The text was updated successfully, but these errors were encountered: