Skip to content

BUG: avoid segmentation fault in string_expandtabs_length_promoter #29368

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

riku-sakamoto
Copy link

@riku-sakamoto riku-sakamoto commented Jul 13, 2025

Fixes the first item in #28829. op_dtypes[0] may be null, so use op_dtypes[1] instead.

This is my first PR to NumPy, so please let me know if there's anything I should fix or improve.

Root Cause

  • When calling string_expandtabs_length_promoter, the first item of op_dtypes can 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 a UFuncTypeError, instead of causing a segmentation fault.

@riku-sakamoto riku-sakamoto marked this pull request as draft July 13, 2025 16:55
Fixes the first item in numpy#28829. `op_dtypes[0]` may be null, so use `op_dtypes[1]` instead.
@riku-sakamoto riku-sakamoto force-pushed the fix_expandtabs_length_segfault branch from 13d91c7 to 1aae38f Compare July 13, 2025 17:24
@ngoldbaum
Copy link
Member

ping @lysnikolaou

@riku-sakamoto riku-sakamoto marked this pull request as ready for review July 13, 2025 17:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy