Skip to content

Commit 49d0d42

Browse files
committed
Fix validity check
1 parent b7a8b5d commit 49d0d42

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

Include/internal/pycore_stackref.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,8 @@ static const _PyStackRef PyStackRef_NULL = { .bits = PyStackRef_NULL_BITS };
223223
#define PyStackRef_IsFalse(ref) (((ref).bits & (~Py_TAG_BITS)) == ((uintptr_t)&_Py_FalseStruct))
224224

225225

226+
#ifdef Py_DEBUG
227+
226228
static inline void PyStackRef_CheckValid(_PyStackRef ref) {
227229
int tag = ref.bits & Py_TAG_BITS;
228230
PyObject *obj = BITS_TO_PTR_MASKED(ref);
@@ -242,7 +244,6 @@ static inline void PyStackRef_CheckValid(_PyStackRef ref) {
242244
}
243245
}
244246

245-
#ifdef Py_DEBUG
246247
static inline int
247248
PyStackRef_IsNone(_PyStackRef ref)
248249
{
@@ -255,6 +256,7 @@ PyStackRef_IsNone(_PyStackRef ref)
255256

256257
#else
257258

259+
#define PyStackRef_CheckValid(REF) ((void)0)
258260
#define PyStackRef_IsNone(REF) ((REF).bits == (((uintptr_t)&_Py_NoneStruct) | Py_TAG_IMMORTAL))
259261

260262
#endif

0 commit comments

Comments
 (0)