Skip to content

Commit f6126b1

Browse files
committed
Handle negative ints properly in Py_STACKREF_DEBUG build
1 parent b491544 commit f6126b1

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

Python/stackrefs.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,8 @@ intptr_t
206206
PyStackRef_UntagInt(_PyStackRef i)
207207
{
208208
assert(is_tagged_int(i));
209-
return Py_ARITHMETIC_RIGHT_SHIFT(intptr_t, i.index, 1);
209+
intptr_t val = (intptr_t)i.index;
210+
return Py_ARITHMETIC_RIGHT_SHIFT(intptr_t, val, 1);
210211
}
211212

212213
bool PyStackRef_IsTaggedInt(_PyStackRef ref)

0 commit comments

Comments
 (0)