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
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
BUG: avoid segmentation fault in string_expandtabs_length_promoter
Fixes the first item in #28829. `op_dtypes[0]` may be null, so use `op_dtypes[1]` instead.
  • Loading branch information
riku-sakamoto committed Jul 13, 2025
commit 1aae38fcec81efd9c8c7eaed83b65e9f29de2252
5 changes: 3 additions & 2 deletions numpy/_core/src/umath/string_ufuncs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -941,8 +941,9 @@ string_expandtabs_length_promoter(PyObject *NPY_UNUSED(ufunc),
PyArray_DTypeMeta *const op_dtypes[], PyArray_DTypeMeta *const signature[],
PyArray_DTypeMeta *new_op_dtypes[])
{
Py_INCREF(op_dtypes[0]);
new_op_dtypes[0] = op_dtypes[0];
PyArray_DTypeMeta* _op_dtype = op_dtypes[0] ? op_dtypes[0] : op_dtypes[1];
Py_INCREF(_op_dtype);
new_op_dtypes[0] = _op_dtype;
new_op_dtypes[1] = NPY_DT_NewRef(&PyArray_Int64DType);
new_op_dtypes[2] = PyArray_DTypeFromTypeNum(NPY_DEFAULT_INT);
return 0;
Expand Down
Loading
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