The error_converting macro checks ((x) == -1) && PyErr_Occurred(). When true, an exception is already active (e.g., OverflowError from PyArray_PyIntAsInt). The immediately following TYPE_ERR call overwrites it with a generic TypeError, discarding the more informative original exception.
Example: passing a too-large integer for window produces OverflowError: Python int too large to convert to C int, which is then replaced with TypeError: 'window' must be an integer.
Approximately 15 instances across all template files.
File(s): move_template.c:940-941,950-951,978-979,1000-1001 and similar in reduce_template.c, nonreduce_axis_template.c
Suggested fix: Either propagate the original exception directly (goto error;) or clear it intentionally before setting the new one (PyErr_Clear(); TYPE_ERR(...);).
See #518 for the complete report.
Found using cext-review-toolkit.
The
error_convertingmacro checks((x) == -1) && PyErr_Occurred(). When true, an exception is already active (e.g.,OverflowErrorfromPyArray_PyIntAsInt). The immediately followingTYPE_ERRcall overwrites it with a genericTypeError, discarding the more informative original exception.Example: passing a too-large integer for
windowproducesOverflowError: Python int too large to convert to C int, which is then replaced withTypeError: 'window' must be an integer.Approximately 15 instances across all template files.
File(s):
move_template.c:940-941,950-951,978-979,1000-1001and similar inreduce_template.c,nonreduce_axis_template.cSuggested fix: Either propagate the original exception directly (
goto error;) or clear it intentionally before setting the new one (PyErr_Clear(); TYPE_ERR(...);).See #518 for the complete report.
Found using cext-review-toolkit.