BUG: avoid segmentation fault in string_expandtabs_length_promoter by charris · Pull Request #29920 · numpy/numpy
Navigation Menu
{{ message }}
- Notifications You must be signed in to change notification settings
- Fork 12.1k
Merged
charris merged 2 commits intonumpy:maintenance/2.3.xfrom
Oct 10, 2025Merged
BUG: avoid segmentation fault in string_expandtabs_length_promoter#29920
charris merged 2 commits intonumpy:maintenance/2.3.xfrom
BUG: avoid segmentation fault in string_expandtabs_length_promoter#29920
charris merged 2 commits intonumpy:maintenance/2.3.xfrom
Conversation
Copy link
Member
charris
commented
Oct 10, 2025
charris
commented
Backport of #29368.
Fix to use Py_XINCREF instead of Py_INCREF to safely handle the case where op_dtypes[0] is NULL
Root Cause
- When calling
string_expandtabs_length_promoter, the first item ofop_dtypescan be NULL.
Rationale
- As noted in this comment regarding
ops, legacy type resolution does not handle NULL well. Therefore, I changed the logic to use the second item instead.
Outcome
numpy._core.strings._expandtabs_length.reduce(numpy.zeros(200))now raises aUFuncTypeError, instead of causing a segmentation fault.
charris
added this to the
2.3.4 release milestone
riku-sakamoto added 2 commits
October 10, 2025 10:24…gth.reduce` Fixes the first item of numpy#28829. Use `Py_XINCREF` instead of `Py_INCREF` to safely handle the case where `op_dtypes[0]` is NULL
charris
force-pushed
the
backport-29368
branch
from
59995d1 to
f123253
Compare
charris
deleted the
backport-29368
branch
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment