Skip to content

Commit d60ef23

Browse files
committed
Checked for tagged ints
1 parent d9dc597 commit d60ef23

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

Include/internal/pycore_stackref.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ PyStackRef_IsNullOrInt(_PyStackRef ref);
247247
static inline bool
248248
PyStackRef_IsTaggedInt(_PyStackRef i)
249249
{
250-
return (i.bits & Py_INT_TAG) == Py_INT_TAG;
250+
return (i.bits & Py_TAG_BITS) == Py_INT_TAG;
251251
}
252252

253253
static inline _PyStackRef
@@ -274,6 +274,7 @@ PyStackRef_IncrementTaggedIntNoOverflow(_PyStackRef ref)
274274
return (_PyStackRef){ .bits = ref.bits + 4 };
275275
}
276276

277+
#define PyStackRef_IsDeferredOrTaggedInt(ref) (((ref).bits & Py_TAG_REFCNT) != 0)
277278

278279
#ifdef Py_GIL_DISABLED
279280

@@ -407,7 +408,7 @@ static inline _PyStackRef
407408
PyStackRef_DUP(_PyStackRef stackref)
408409
{
409410
assert(!PyStackRef_IsNull(stackref));
410-
if (PyStackRef_IsDeferred(stackref)) {
411+
if (PyStackRef_IsDeferredOrTaggedInt(stackref)) {
411412
return stackref;
412413
}
413414
Py_INCREF(PyStackRef_AsPyObjectBorrow(stackref));

0 commit comments

Comments
 (0)