8000 BUG: set the array_owned flag on the StringDType singleton · r-devulap/numpy@9642714 · GitHub
[go: up one dir, main page]

Skip to content

Commit 9642714

Browse files
committed
BUG: set the array_owned flag on the StringDType singleton
1 parent 1bc8764 commit 9642714

File tree

1 file changed

+6
-3
lines changed
  • numpy/_core/src/multiarray/stringdtype

1 file changed

+6
-3
lines changed

numpy/_core/src/multiarray/stringdtype/dtype.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -850,14 +850,17 @@ init_string_dtype(void)
850850
return -1;
851851
}
852852

853-
PyArray_Descr *singleton =
854-
NPY_DT_CALL_default_descr(&PyArray_StringDType);
853+
PyArray_StringDTypeObject *singleton =
854+
(PyArray_StringDTypeObject *)NPY_DT_CALL_default_descr(&PyArray_StringDType);
855855

856856
if (singleton == NULL) {
857857
return -1;
858858
}
859859

860-
PyArray_StringDType.singleton = singleton;
860+
// never associate the singleton with an array
861+
singleton->array_owned = 1;
862+
863+
PyArray_StringDType.singleton = (PyArray_Descr *)singleton;
861864
PyArray_StringDType.type_num = NPY_VSTRING;
862865

863866
for (int i = 0; PyArray_StringDType_casts[i] != NULL; i++) {

0 commit comments

Comments
 (0)
0