File tree Expand file tree Collapse file tree 1 file changed +5
-0
lines changed
numpy/_core/src/multiarray/stringdtype Expand file tree Collapse file tree 1 file changed +5
-0
lines changed Original file line number Diff line number Diff line change @@ -633,11 +633,16 @@ PyArray_Descr *
633633stringdtype_finalize_descr (PyArray_Descr * dtype )
634634{
635635 PyArray_StringDTypeObject * sdtype = (PyArray_StringDTypeObject * )dtype ;
636+ // acquire the allocator lock in case the descriptor we want to finalize
637+ // is shared between threads, see gh-28813
638+ npy_string_allocator * allocator = NpyString_acquire_allocator (sdtype );
636639 if (sdtype -> array_owned == 0 ) {
637640 sdtype -> array_owned = 1 ;
641+ NpyString_release_allocator (allocator );
638642 Py_INCREF (dtype );
639643 return dtype ;
640644 }
645+ NpyString_release_allocator (allocator );
641646 PyArray_StringDTypeObject * ret = (PyArray_StringDTypeObject * )new_stringdtype_instance (
642647 sdtype -> na_object , sdtype -> coerce );
643648 ret -> array_owned = 1 ;
You can’t perform that action at this time.
0 commit comments