diff --git a/Include/internal/pycore_stackref.h b/Include/internal/pycore_stackref.h index 062834368bcd29..6e8daed3776327 100644 --- a/Include/internal/pycore_stackref.h +++ b/Include/internal/pycore_stackref.h @@ -293,7 +293,7 @@ PyStackRef_Unwrap(_PyStackRef ref) static inline bool PyStackRef_IsError(_PyStackRef ref) { - return ref.bits == Py_TAG_INVALID; + return (ref.bits & Py_TAG_BITS) == Py_TAG_INVALID; } static inline bool diff --git a/Python/ceval.c b/Python/ceval.c index 0ccaacaf3ed5b1..81c7466859eec2 100644 --- a/Python/ceval.c +++ b/Python/ceval.c @@ -160,6 +160,10 @@ dump_item(_PyStackRef item) printf(""); return; } + if (PyStackRef_IsError(item)) { + printf(""); + return; + } if (PyStackRef_IsTaggedInt(item)) { printf("%" PRId64, (int64_t)PyStackRef_UntagInt(item)); return;