diff --git a/numpy/_core/src/common/npy_hashtable.cpp b/numpy/_core/src/common/npy_hashtable.cpp index de3194ac05d2..2a0f76dcf73b 100644 --- a/numpy/_core/src/common/npy_hashtable.cpp +++ b/numpy/_core/src/common/npy_hashtable.cpp @@ -126,10 +126,10 @@ NPY_NO_EXPORT void PyArrayIdentityHash_Dealloc(PyArrayIdentityHash *tb) { PyMem_Free(tb->buckets); - PyMem_Free(tb); #ifdef Py_GIL_DISABLED delete (std::shared_mutex *)tb->mutex; #endif + PyMem_Free(tb); }