-
-
Notifications
You must be signed in to change notification settings - Fork 12.1k
Closed
Description
Right now, many failures of np.dtype(obj) go to this path:
numpy/numpy/core/src/multiarray/descriptor.c
Lines 42 to 49 in 80fc0f5
| /* | |
| * Generate a vague error message when a function returned NULL but forgot | |
| * to set an exception. We should aim to remove this eventually. | |
| */ | |
| static void | |
| _report_generic_error(void) { | |
| PyErr_SetString(PyExc_TypeError, "data type not understood"); | |
| } |
For example
numpy/numpy/core/src/multiarray/descriptor.c
Lines 443 to 446 in 80fc0f5
| if (!PyTuple_Check(item) || (PyTuple_GET_SIZE(item) < 2)) { | |
| _report_generic_error(); | |
| goto fail; | |
| } |
We should replace some or all of these calls in this file with more helpful error messages, such as in the above case:
-_report_generic_error();
+PyErr_Format(PyExc_TypeError, "Field elements must be 2-tuples, got %R", item);If we replace all of them, then we should remove the _report_generic_error function entirely
Reactions are currently unavailable