-
-
Notifications
You must be signed in to change notification settings - Fork 11.9k
Closed
Labels
00 - BugsprintableIssue fits the time-frame and setting of a sprintIssue fits the time-frame and setting of a sprint
Description
Describe the issue:
It looks as though there's a code path in which ndarray.__deepcopy__ sets an exception but fails to return NULL, confusing Python as a result. This was reported upstream on the CPython bug tracker at python/cpython#94390, but looks as though it's likely a problem with NumPy.
#8706 looks relevant here. Specifically, I suspect that itemp is NULL in this call, resulting in the PyObject_CallFunctionObjArgs argument list being cut short.
I wasn't able to reproduce with an empty array of dtype object created directly with np.empty; it's not clear to me when such an array gets filled with NULLs and when it gets filled with pointers to Py_None.
Reproduce the code example:
import numpy as np
np.empty_like([slice(3)]).__deepcopy__({})Error message:
TypeError: deepcopy() missing 1 required positional argument: 'x'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
SystemError: <method '__deepcopy__' of 'numpy.ndarray' objects> returned a result with an exception setNumPy/Python version information:
1.22.4 3.10.5 (main, Jun 7 2022, 08:51:33) [Clang 13.0.0 (clang-1300.0.29.30)]
Metadata
Metadata
Assignees
Labels
00 - BugsprintableIssue fits the time-frame and setting of a sprintIssue fits the time-frame and setting of a sprint