Skip to content

Commit ed89950

Browse files
committed
Rename function
1 parent e8f4ce6 commit ed89950

File tree

6 files changed

+15
-14
lines changed

6 files changed

+15
-14
lines changed

Include/internal/pycore_stackref.h

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,8 @@ extern intptr_t PyStackRef_UntagInt(_PyStackRef ref);
233233

234234
extern _PyStackRef PyStackRef_TagInt(intptr_t i);
235235

236-
extern _PyStackRef PyStackRef_IncrementTaggedInt(_PyStackRef ref);
236+
/* Increments a tagged int, but does not check for overflow */
237+
extern _PyStackRef PyStackRef_IncrementTaggedIntNoOverflow(_PyStackRef ref);
237238

238239
extern bool
239240
PyStackRef_IsNullOrInt(_PyStackRef ref);
@@ -265,9 +266,9 @@ PyStackRef_UntagInt(_PyStackRef i)
265266

266267

267268
static inline _PyStackRef
268-
PyStackRef_IncrementTaggedInt(_PyStackRef ref)
269+
PyStackRef_IncrementTaggedIntNoOverflow(_PyStackRef ref)
269270
{
270-
assert(ref.bits != (uintptr_t)-1); // Overflow
271+
assert(ref.bits != (uintptr_t)-1); // Deosn't overflow
271272
return (_PyStackRef){ .bits = ref.bits + 4 };
272273
}
273274

Python/bytecodes.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3112,7 +3112,7 @@ dummy_func(
31123112
JUMPBY(oparg + 1);
31133113
DISPATCH();
31143114
}
3115-
null_or_index = PyStackRef_IncrementTaggedInt(null_or_index);
3115+
null_or_index = PyStackRef_IncrementTaggedIntNoOverflow(null_or_index);
31163116
}
31173117
else {
31183118
PyObject *next_o = (*Py_TYPE(iter_o)->tp_iternext)(iter_o);
@@ -3254,7 +3254,7 @@ dummy_func(
32543254
#else
32553255
next = PyStackRef_FromPyObjectNew(PyList_GET_ITEM(list_o, PyStackRef_UntagInt(null_or_index)));
32563256
#endif
3257-
null_or_index = PyStackRef_IncrementTaggedInt(null_or_index);
3257+
null_or_index = PyStackRef_IncrementTaggedIntNoOverflow(null_or_index);
32583258
}
32593259

32603260
// Only used by Tier 2
@@ -3273,7 +3273,7 @@ dummy_func(
32733273
assert(PyStackRef_UntagInt(null_or_index) < PyList_GET_SIZE(list_o));
32743274
next = PyStackRef_FromPyObjectNew(PyList_GET_ITEM(list_o, PyStackRef_UntagInt(null_or_index)));
32753275
#endif
3276-
null_or_index = PyStackRef_IncrementTaggedInt(null_or_index);
3276+
null_or_index = PyStackRef_IncrementTaggedIntNoOverflow(null_or_index);
32773277
}
32783278

32793279
macro(FOR_ITER_LIST) =
@@ -3317,7 +3317,7 @@ dummy_func(
33173317
uintptr_t i = PyStackRef_UntagInt(null_or_index);
33183318
assert((size_t)i < (size_t)PyTuple_GET_SIZE(tuple_o));
33193319
next = PyStackRef_FromPyObjectNew(PyTuple_GET_ITEM(tuple_o, i));
3320-
null_or_index = PyStackRef_IncrementTaggedInt(null_or_index);
3320+
null_or_index = PyStackRef_IncrementTaggedIntNoOverflow(null_or_index);
33213321
}
33223322

33233323
macro(FOR_ITER_TUPLE) =

Python/executor_cases.c.h

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Python/generated_cases.c.h

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Python/stackrefs.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ PyStackRef_IsNullOrInt(_PyStackRef ref)
217217
}
218218

219219
_PyStackRef
220-
PyStackRef_IncrementTaggedInt(_PyStackRef ref)
220+
PyStackRef_IncrementTaggedIntNoOverflow(_PyStackRef ref)
221221
{
222222
assert(ref.index != (uintptr_t)-1); // Overflow
223223
return (_PyStackRef){ .index = ref.index + 2 };

Tools/cases_generator/analyzer.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -679,7 +679,7 @@ def has_error_without_pop(op: parser.CodeDef) -> bool:
679679
"PyStackRef_IsTaggedInt",
680680
"PyStackRef_TagInt",
681681
"PyStackRef_UntagInt",
682-
"PyStackRef_IncrementTaggedInt",
682+
"PyStackRef_IncrementTaggedIntNoOverflow",
683683
"PyStackRef_IsNullOrInt",
684684
)
685685

0 commit comments

Comments
 (0)