File tree Expand file tree Collapse file tree 2 files changed +10
-3
lines changed
Expand file tree Collapse file tree 2 files changed +10
-3
lines changed Original file line number Diff line number Diff line change @@ -1004,9 +1004,7 @@ _lsprof_exec(PyObject *module)
10041004
10051005static PyModuleDef_Slot _lsprofslots [] = {
10061006 {Py_mod_exec , _lsprof_exec },
1007- // XXX gh-103092: fix isolation.
1008- {Py_mod_multiple_interpreters , Py_MOD_MULTIPLE_INTERPRETERS_NOT_SUPPORTED },
1009- //{Py_mod_multiple_interpreters, Py_MOD_PER_INTERPRETER_GIL_SUPPORTED},
1007+ {Py_mod_multiple_interpreters , Py_MOD_PER_INTERPRETER_GIL_SUPPORTED },
10101008 {0 , NULL }
10111009};
10121010
Original file line number Diff line number Diff line change 1+ #ifndef Py_BUILD_CORE_BUILTIN
2+ # define Py_BUILD_CORE_MODULE 1
3+ #endif
4+
5+ #include "Python.h"
6+ #include "pycore_lock.h"
17#include "rotatingtree.h"
28
39#define KEY_LOWER_THAN (key1 , key2 ) ((char*)(key1) < (char*)(key2))
1016
1117static unsigned int random_value = 1 ;
1218static unsigned int random_stream = 0 ;
19+ static PyMutex random_mutex = (PyMutex ){0 };
1320
1421static int
1522randombits (int bits )
1623{
1724 int result ;
25+ PyMutex_Lock (& random_mutex );
1826 if (random_stream < (1U << bits )) {
1927 random_value *= 1082527 ;
2028 random_stream = random_value ;
2129 }
2230 result = random_stream & ((1 <<bits )- 1 );
2331 random_stream >>= bits ;
32+ PyMutex_Unlock (& random_mutex );
2433 return result ;
2534}
2635
You can’t perform that action at this time.
0 commit comments