Skip to content

Commit 477b43c

Browse files
committed
Keep the old definition of PyStackRef_IsHeapSafe in default build
1 parent a2c45c6 commit 477b43c

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Include/internal/pycore_stackref.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -628,14 +628,14 @@ PyStackRef_DUP(_PyStackRef ref)
628628
static inline bool
629629
PyStackRef_IsHeapSafe(_PyStackRef ref)
630630
{
631+
#ifdef Py_GIL_DISABLED
631632
if ((ref.bits & Py_TAG_BITS) != Py_TAG_REFCNT) {
632633
return true;
633634
}
634635
PyObject *obj = BITS_TO_PTR_MASKED(ref);
635-
#ifdef Py_GIL_DISABLED
636636
return obj == NULL || _PyObject_HasDeferredRefcount(obj);
637637
#else
638-
return obj == NULL || _Py_IsImmortal(obj);
638+
return (ref.bits & Py_TAG_BITS) != Py_TAG_REFCNT || ref.bits == PyStackRef_NULL_BITS || _Py_IsImmortal(BITS_TO_PTR_MASKED(ref));
639639
#endif
640640
}
641641

0 commit comments

Comments
 (0)