@@ -3080,10 +3080,11 @@ dummy_func(
30803080 else {
30813081 PyObject * iter_o = PyStackRef_AsPyObjectBorrow (iterable );
30823082 if (tp == & PyRange_Type && _PyRange_IsSimpleCompact (iter_o )) {
3083+ Py_ssize_t start = _PyRange_GetStartIfCompact (iter_o );
30833084 Py_ssize_t stop = _PyRange_GetStopIfCompact (iter_o );
30843085 PyStackRef_CLOSE (iterable );
30853086 iter = PyStackRef_TagInt (stop );
3086- index_or_null = PyStackRef_TagInt (0 );
3087+ index_or_null = PyStackRef_TagInt (start );
30873088 }
30883089 else {
30893090 iter_o = PyObject_GetIter (iter_o );
@@ -3171,8 +3172,7 @@ dummy_func(
31713172 /* before: [iter]; after: [iter, iter()] *or* [] (and jump over END_FOR.) */
31723173 if (PyStackRef_IsTaggedInt (null_or_index )) {
31733174 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 )) {
31763176 JUMPBY (oparg + 1 );
31773177 DISPATCH ();
31783178
@@ -3242,14 +3242,11 @@ dummy_func(
32423242
32433243
32443244 inst (INSTRUMENTED_FOR_ITER , (unused /1 , iter , null_or_index -- iter , null_or_index , next )) {
3245- PyObject * iter_o = PyStackRef_AsPyObjectBorrow (iter );
32463245 if (PyStackRef_IsTaggedInt (null_or_index )) {
32473246 if (PyStackRef_IsTaggedInt (iter )) {
3248- if (PyStackRef_Is (iter , null_or_index )) {
3249- null_or_index = PyStackRef_TagInt (-1 );
3247+ if (!PyStackRef_TaggedIntLessThan (null_or_index , iter )) {
32503248 JUMPBY (oparg + 1 );
32513249 DISPATCH ();
3252-
32533250 }
32543251 next = PyStackRef_BoxInt (null_or_index );
32553252 if (PyStackRef_IsNull (next )) {
@@ -3258,6 +3255,7 @@ dummy_func(
32583255 null_or_index = PyStackRef_IncrementTaggedIntNoOverflow (null_or_index );
32593256 }
32603257 else {
3258+ PyObject * iter_o = PyStackRef_AsPyObjectBorrow (iter );
32613259 next = _PyForIter_NextWithIndex (iter_o , null_or_index );
32623260 if (PyStackRef_IsNull (next )) {
32633261 JUMPBY (oparg + 1 );
@@ -3268,6 +3266,7 @@ dummy_func(
32683266 INSTRUMENTED_JUMP (this_instr , next_instr , PY_MONITORING_EVENT_BRANCH_LEFT );
32693267 }
32703268 else {
3269+ PyObject * iter_o = PyStackRef_AsPyObjectBorrow (iter );
32713270 PyObject * next_o = (* Py_TYPE (iter_o )-> tp_iternext )(iter_o );
32723271 if (next_o != NULL ) {
32733272 next = PyStackRef_FromPyObjectSteal (next_o );
@@ -3423,7 +3422,7 @@ dummy_func(
34233422 }
34243423
34253424 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 )) {
34273426 // Jump over END_FOR instruction.
34283427 JUMPBY (oparg + 1 );
34293428 DISPATCH ();
@@ -3432,7 +3431,7 @@ dummy_func(
34323431
34333432 // Only used by Tier 2
34343433 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 ));
34363435 }
34373436
34383437 op (_ITER_NEXT_RANGE , (iter , null_or_index -- iter , null_or_index , next )) {
0 commit comments