Skip to content

Commit 8fd3f20

Browse files
committed
Fix free threaded build
1 parent 99dae60 commit 8fd3f20

File tree

1 file changed

+2
-12
lines changed

1 file changed

+2
-12
lines changed

Python/specialize.c

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1314,7 +1314,8 @@ specialize_load_global_lock_held(
13141314
goto fail;
13151315
}
13161316
PyObject *value = NULL;
1317-
if (PyDict_GetItemRef(globals, name, &value) < 0) {
1317+
Py_ssize_t index = _PyDict_LookupIndexAndValue((PyDictObject *)globals, name, &value);
1318+
if (index == DKIX_ERROR) {
13181319
SPECIALIZATION_FAIL(LOAD_GLOBAL, SPEC_FAIL_EXPECTED_ERROR);
13191320
goto fail;
13201321
}
@@ -1323,17 +1324,6 @@ specialize_load_global_lock_held(
13231324
Py_DECREF(value);
13241325
goto fail;
13251326
}
1326-
Py_XDECREF(value);
1327-
#ifdef Py_GIL_DISABLED
1328-
PyObject *value;
1329-
Py_ssize_t index = _PyDict_LookupIndexAndValue((PyDictObject *)globals, name, &value);
1330-
#else
1331-
Py_ssize_t index = _PyDictKeys_StringLookup(globals_keys, name);
1332-
#endif
1333-
if (index == DKIX_ERROR) {
1334-
SPECIALIZATION_FAIL(LOAD_GLOBAL, SPEC_FAIL_EXPECTED_ERROR);
1335-
goto fail;
1336-
}
13371327
PyInterpreterState *interp = _PyInterpreterState_GET();
13381328
if (index != DKIX_EMPTY) {
13391329
if (index != (uint16_t)index) {

0 commit comments

Comments
 (0)