@@ -3080,10 +3080,11 @@ dummy_func(
3080
3080
else {
3081
3081
PyObject * iter_o = PyStackRef_AsPyObjectBorrow (iterable );
3082
3082
if (tp == & PyRange_Type && _PyRange_IsSimpleCompact (iter_o )) {
3083
+ Py_ssize_t start = _PyRange_GetStartIfCompact (iter_o );
3083
3084
Py_ssize_t stop = _PyRange_GetStopIfCompact (iter_o );
3084
3085
PyStackRef_CLOSE (iterable );
3085
3086
iter = PyStackRef_TagInt (stop );
3086
- index_or_null = PyStackRef_TagInt (0 );
3087
+ index_or_null = PyStackRef_TagInt (start );
3087
3088
}
3088
3089
else {
3089
3090
iter_o = PyObject_GetIter (iter_o );
@@ -3171,8 +3172,7 @@ dummy_func(
3171
3172
/* before: [iter]; after: [iter, iter()] *or* [] (and jump over END_FOR.) */
3172
3173
if (PyStackRef_IsTaggedInt (null_or_index )) {
3173
3174
if (PyStackRef_IsTaggedInt (iter )) {
3174
- if (PyStackRef_Is (iter , null_or_index )) {
3175
- null_or_index = PyStackRef_TagInt (-1 );
3175
+ if (!PyStackRef_TaggedIntLessThan (null_or_index , iter )) {
3176
3176
JUMPBY (oparg + 1 );
3177
3177
DISPATCH ();
3178
3178
@@ -3243,14 +3243,11 @@ dummy_func(
3243
3243
3244
3244
3245
3245
inst (INSTRUMENTED_FOR_ITER , (unused /1 , iter , null_or_index -- iter , null_or_index , next )) {
3246
- PyObject * iter_o = PyStackRef_AsPyObjectBorrow (iter );
3247
3246
if (PyStackRef_IsTaggedInt (null_or_index )) {
3248
3247
if (PyStackRef_IsTaggedInt (iter )) {
3249
- if (PyStackRef_Is (iter , null_or_index )) {
3250
- null_or_index = PyStackRef_TagInt (-1 );
3248
+ if (!PyStackRef_TaggedIntLessThan (null_or_index , iter )) {
3251
3249
JUMPBY (oparg + 1 );
3252
3250
DISPATCH ();
3253
-
3254
3251
}
3255
3252
next = PyStackRef_BoxInt (null_or_index );
3256
3253
if (PyStackRef_IsNull (next )) {
@@ -3259,6 +3256,7 @@ dummy_func(
3259
3256
null_or_index = PyStackRef_IncrementTaggedIntNoOverflow (null_or_index );
3260
3257
}
3261
3258
else {
3259
+ PyObject * iter_o = PyStackRef_AsPyObjectBorrow (iter );
3262
3260
next = _PyForIter_NextWithIndex (iter_o , null_or_index );
3263
3261
if (PyStackRef_IsNull (next )) {
3264
3262
JUMPBY (oparg + 1 );
@@ -3268,6 +3266,7 @@ dummy_func(
3268
3266
INSTRUMENTED_JUMP (this_instr , next_instr , PY_MONITORING_EVENT_BRANCH_LEFT );
3269
3267
}
3270
3268
else {
3269
+ PyObject * iter_o = PyStackRef_AsPyObjectBorrow (iter );
3271
3270
PyObject * next_o = (* Py_TYPE (iter_o )-> tp_iternext )(iter_o );
3272
3271
if (next_o != NULL ) {
3273
3272
next = PyStackRef_FromPyObjectSteal (next_o );
@@ -3423,7 +3422,7 @@ dummy_func(
3423
3422
}
3424
3423
3425
3424
replaced op (_ITER_JUMP_RANGE , (iter , null_or_index -- iter , null_or_index )) {
3426
- if (PyStackRef_Is ( iter , null_or_index )) {
3425
+ if (! PyStackRef_TaggedIntLessThan ( null_or_index , iter )) {
3427
3426
// Jump over END_FOR instruction.
3428
3427
JUMPBY (oparg + 1 );
3429
3428
DISPATCH ();
@@ -3432,7 +3431,7 @@ dummy_func(
3432
3431
3433
3432
// Only used by Tier 2
3434
3433
op (_GUARD_NOT_EXHAUSTED_RANGE , (iter , null_or_index -- iter , null_or_index )) {
3435
- EXIT_IF (PyStackRef_Is ( iter , null_or_index ));
3434
+ EXIT_IF (! PyStackRef_TaggedIntLessThan ( null_or_index , iter ));
3436
3435
}
3437
3436
3438
3437
op (_ITER_NEXT_RANGE , (iter , null_or_index -- iter , null_or_index , next )) {
0 commit comments