Skip to content

Commit fbda208

Browse files
Use _Py_IMMORTAL_FLAGS == Py_TAG_REFCNT check on all builds
1 parent df6ea14 commit fbda208

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

Include/internal/pycore_stackref.h

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,13 @@ extern "C" {
5757

5858
#define Py_TAGGED_SHIFT 2
5959

60+
/* References to immortal objects always have their tag bit set to Py_TAG_REFCNT
61+
* as they can (must) have their reclamation deferred */
62+
63+
#if _Py_IMMORTAL_FLAGS != Py_TAG_REFCNT
64+
# error "_Py_IMMORTAL_FLAGS != Py_TAG_REFCNT"
65+
#endif
66+
6067
#if !defined(Py_GIL_DISABLED) && defined(Py_STACKREF_DEBUG)
6168

6269
PyAPI_FUNC(PyObject *) _Py_stackref_get_object(_PyStackRef ref);
@@ -636,13 +643,6 @@ PyStackRef_AsStrongReference(_PyStackRef stackref)
636643

637644
// With GIL
638645

639-
/* References to immortal objects always have their tag bit set to Py_TAG_REFCNT
640-
* as they can (must) have their reclamation deferred */
641-
642-
#if _Py_IMMORTAL_FLAGS != Py_TAG_REFCNT
643-
# error "_Py_IMMORTAL_FLAGS != Py_TAG_REFCNT"
644-
#endif
645-
646646
#define BITS_TO_PTR(REF) ((PyObject *)((REF).bits))
647647
#define BITS_TO_PTR_MASKED(REF) ((PyObject *)(((REF).bits) & (~Py_TAG_REFCNT)))
648648

0 commit comments

Comments
 (0)