Skip to content

Commit 245d580

Browse files
committed
fix
1 parent 55aa240 commit 245d580

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

Objects/typeobject.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5700,6 +5700,12 @@ _PyType_CacheGetItemForSpecialization(PyHeapTypeObject *ht, PyObject *descriptor
57005700
// This pointer is invalidated by PyType_Modified (see the comment on
57015701
// struct _specialization_cache):
57025702
PyFunctionObject *func = (PyFunctionObject *)descriptor;
5703+
#ifdef Py_GIL_DISABLED
5704+
if (!_PyObject_HasDeferredRefcount(func)) {
5705+
ret = -1;
5706+
goto end;
5707+
}
5708+
#endif
57035709
uint32_t version = _PyFunction_GetVersionForCurrentState(func);
57045710
if (!_PyFunction_IsVersionValid(version)) {
57055711
ret = -1;

0 commit comments

Comments
 (0)