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)
1004
1004
1005
1005
static PyModuleDef_Slot _lsprofslots [] = {
1006
1006
{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 },
1010
1008
{0 , NULL }
1011
1009
};
1012
1010
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"
1
7
#include "rotatingtree.h"
2
8
3
9
#define KEY_LOWER_THAN (key1 , key2 ) ((char*)(key1) < (char*)(key2))
10
16
11
17
static unsigned int random_value = 1 ;
12
18
static unsigned int random_stream = 0 ;
19
+ static PyMutex random_mutex = (PyMutex ){0 };
13
20
14
21
static int
15
22
randombits (int bits )
16
23
{
17
24
int result ;
25
+ PyMutex_Lock (& random_mutex );
18
26
if (random_stream < (1U << bits )) {
19
27
random_value *= 1082527 ;
20
28
random_stream = random_value ;
21
29
}
22
30
result = random_stream & ((1 <<bits )- 1 );
23
31
random_stream >>= bits ;
32
+ PyMutex_Unlock (& random_mutex );
24
33
return result ;
25
34
}
26
35
You can’t perform that action at this time.
0 commit comments