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 16
16
#include "dragon4.h"
17
17
18
18
#ifdef Py_GIL_DISABLED
19
- static PyMutex quad_creation_mutex = {0 };
19
+ static PyMutex scalar_mutex = {0 };
20
20
#endif
21
21
22
22
QuadPrecisionObject *
23
23
QuadPrecision_raw_new (QuadBackendType backend )
24
24
{
25
25
QuadPrecisionObject * new ;
26
26
#ifdef Py_GIL_DISABLED
27
- PyMutex_Lock (& quad_creation_mutex );
27
+ PyMutex_Lock (& scalar_mutex );
28
28
#endif
29
29
new = PyObject_New (QuadPrecisionObject , & QuadPrecision_Type );
30
30
#ifdef Py_GIL_DISABLED
31
- PyMutex_Unlock (& quad_creation_mutex );
31
+ PyMutex_Unlock (& scalar_mutex );
32
32
#endif
33
33
34
34
if (!new )
@@ -196,13 +196,19 @@ QuadPrecision_str(QuadPrecisionObject *self)
196
196
static PyObject *
197
197
QuadPrecision_repr (QuadPrecisionObject * self )
198
198
{
199
+ #ifdef Py_GIL_DISABLED
200
+ PyMutex_Lock (& scalar_mutex );
201
+ #endif
199
202
PyObject * str = QuadPrecision_str (self );
200
203
if (str == NULL ) {
201
204
return NULL ;
202
205
}
203
206
const char * backend_str = (self -> backend == BACKEND_SLEEF ) ? "sleef" : "longdouble" ;
204
207
PyObject * res = PyUnicode_FromFormat ("QuadPrecision('%S', backend='%s')" , str , backend_str );
205
208
Py_DECREF (str );
209
+ #ifdef Py_GIL_DISABLED
210
+ PyMutex_Unlock (& scalar_mutex );
211
+ #endif
206
212
return res ;
207
213
}
208
214
You can’t perform that action at this time.
0 commit comments