Skip to content

Commit 13d91c7

Browse files
committed
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.
1 parent 82bd6ef commit 13d91c7

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

numpy/_core/src/umath/string_ufuncs.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -941,8 +941,8 @@ string_expandtabs_length_promoter(PyObject *NPY_UNUSED(ufunc),
941941
PyArray_DTypeMeta *const op_dtypes[], PyArray_DTypeMeta *const signature[],
942942
PyArray_DTypeMeta *new_op_dtypes[])
943943
{
944-
Py_INCREF(op_dtypes[0]);
945-
new_op_dtypes[0] = op_dtypes[0];
944+
Py_INCREF(op_dtypes[1]);
945+
new_op_dtypes[0] = op_dtypes[1];
946946
new_op_dtypes[1] = NPY_DT_NewRef(&PyArray_Int64DType);
947947
new_op_dtypes[2] = PyArray_DTypeFromTypeNum(NPY_DEFAULT_INT);
948948
return 0;

0 commit comments

Comments
 (0)
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