Skip to content

Commit 4b75c14

Browse files
committed
Use _Py_XNewRefWithLock
1 parent 70a09df commit 4b75c14

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

Include/internal/pycore_cell.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
#include "pycore_critical_section.h"
55
#include "pycore_object.h"
6+
#include "pycore_stackref.h"
67

78
#ifdef __cplusplus
89
extern "C" {
@@ -38,7 +39,11 @@ PyCell_GetRef(PyCellObject *cell)
3839
{
3940
PyObject *res;
4041
Py_BEGIN_CRITICAL_SECTION(cell);
42+
#ifdef Py_GIL_DISABLED
43+
res = _Py_XNewRefWithLock(cell->ob_ref);
44+
#else
4145
res = Py_XNewRef(cell->ob_ref);
46+
#endif
4247
Py_END_CRITICAL_SECTION();
4348
return res;
4449
}

0 commit comments

Comments
 (0)