Skip to content

Commit d4f2c37

Browse files
Add PyStackRef_IsMalformed
1 parent 93be070 commit d4f2c37

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

Include/internal/pycore_stackref.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -296,6 +296,12 @@ PyStackRef_IsError(_PyStackRef ref)
296296
return ref.bits == Py_TAG_INVALID;
297297
}
298298

299+
static inline bool
300+
PyStackRef_IsMalformed(_PyStackRef ref)
301+
{
302+
return (ref.bits & Py_TAG_BITS) == Py_TAG_INVALID;
303+
}
304+
299305
static inline bool
300306
PyStackRef_IsValid(_PyStackRef ref)
301307
{

Python/ceval.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ dump_item(_PyStackRef item)
160160
printf("<NULL>");
161161
return;
162162
}
163-
if (PyStackRef_IsError(item)) {
163+
if (PyStackRef_IsMalformed(item)) {
164164
printf("<INVALID>");
165165
return;
166166
}

0 commit comments

Comments
 (0)