File tree Expand file tree Collapse file tree 1 file changed +9
-3
lines changed
quaddtype/numpy_quaddtype/src Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Original file line number Diff line number Diff line change 1616#include "dragon4.h"
1717
1818#ifdef Py_GIL_DISABLED
19- static PyMutex quad_creation_mutex = {0 };
19+ static PyMutex scalar_mutex = {0 };
2020#endif
2121
2222QuadPrecisionObject *
2323QuadPrecision_raw_new (QuadBackendType backend )
2424{
2525 QuadPrecisionObject * new ;
2626#ifdef Py_GIL_DISABLED
27- PyMutex_Lock (& quad_creation_mutex );
27+ PyMutex_Lock (& scalar_mutex );
2828#endif
2929 new = PyObject_New (QuadPrecisionObject , & QuadPrecision_Type );
3030#ifdef Py_GIL_DISABLED
31- PyMutex_Unlock (& quad_creation_mutex );
31+ PyMutex_Unlock (& scalar_mutex );
3232#endif
3333
3434 if (!new )
@@ -196,13 +196,19 @@ QuadPrecision_str(QuadPrecisionObject *self)
196196static PyObject *
197197QuadPrecision_repr (QuadPrecisionObject * self )
198198{
199+ #ifdef Py_GIL_DISABLED
200+ PyMutex_Lock (& scalar_mutex );
201+ #endif
199202 PyObject * str = QuadPrecision_str (self );
200203 if (str == NULL ) {
201204 return NULL ;
202205 }
203206 const char * backend_str = (self -> backend == BACKEND_SLEEF ) ? "sleef" : "longdouble" ;
204207 PyObject * res = PyUnicode_FromFormat ("QuadPrecision('%S', backend='%s')" , str , backend_str );
205208 Py_DECREF (str );
209+ #ifdef Py_GIL_DISABLED
210+ PyMutex_Unlock (& scalar_mutex );
211+ #endif
206212 return res ;
207213}
208214
You can’t perform that action at this time.
0 commit comments