Skip to content

Commit 69e993c

Browse files
committed
Post merge fix up
1 parent c96387a commit 69e993c

File tree

4 files changed

+43
-50
lines changed

4 files changed

+43
-50
lines changed

Lib/test/test_generated_cases.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1442,7 +1442,8 @@ def test_push_then_error(self):
14421442
b = 1;
14431443
if (cond) {
14441444
stack_pointer[0] = a;
1445-
stack_pointer += 1;
1445+
stack_pointer[1] = b;
1446+
stack_pointer += 2;
14461447
assert(WITHIN_STACK_BOUNDS());
14471448
goto error;
14481449
}

Python/bytecodes.c

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -720,6 +720,11 @@ dummy_func(
720720
// specializations, but there is no output.
721721
// At the end we just skip over the STORE_FAST.
722722
op(_BINARY_OP_INPLACE_ADD_UNICODE, (left, right --)) {
723+
PyObject *left_o = PyStackRef_AsPyObjectBorrow(left);
724+
PyObject *right_o = PyStackRef_AsPyObjectBorrow(right);
725+
assert(PyUnicode_CheckExact(left_o));
726+
assert(PyUnicode_CheckExact(right_o));
727+
723728
int next_oparg;
724729
#if TIER_ONE
725730
assert(next_instr->op.code == STORE_FAST);
@@ -728,7 +733,6 @@ dummy_func(
728733
next_oparg = CURRENT_OPERAND0();
729734
#endif
730735
_PyStackRef *target_local = &GETLOCAL(next_oparg);
731-
PyObject *left_o = PyStackRef_AsPyObjectSteal(left);
732736
assert(PyUnicode_CheckExact(left_o));
733737
DEOPT_IF(PyStackRef_AsPyObjectBorrow(*target_local) != left_o);
734738
STAT_INC(BINARY_OP, hit);
@@ -743,12 +747,12 @@ dummy_func(
743747
* only the locals reference, so PyUnicode_Append knows
744748
* that the string is safe to mutate.
745749
*/
746-
PyObject *right_o = PyStackRef_AsPyObjectBorrow(right);
747-
assert(PyUnicode_CheckExact(right_o));
748-
PyStackRef_CLEAR(*target_local);
749-
assert(Py_REFCNT(left_o) >= 1);
750-
PyUnicode_Append(&left_o, right_o);
751-
*target_local = PyStackRef_FromPyObjectSteal(left_o);
750+
assert(Py_REFCNT(left_o) >= 2);
751+
PyStackRef_CLOSE_SPECIALIZED(left, _PyUnicode_ExactDealloc);
752+
DEAD(left);
753+
PyObject *temp = PyStackRef_AsPyObjectSteal(*target_local);
754+
PyUnicode_Append(&temp, right_o);
755+
*target_local = PyStackRef_FromPyObjectSteal(temp);
752756
PyStackRef_CLOSE_SPECIALIZED(right, _PyUnicode_ExactDealloc);
753757
DEAD(right);
754758
ERROR_IF(PyStackRef_IsNull(*target_local), error);
@@ -886,19 +890,15 @@ dummy_func(
886890
#ifdef Py_GIL_DISABLED
887891
PyObject *res_o = _PyList_GetItemRef((PyListObject*)list, index);
888892
DEOPT_IF(res_o == NULL);
889-
STAT_INC(BINARY_SUBSCR, hit);
890-
PyStackRef_CLOSE_SPECIALIZED(sub_st, (destructor)PyObject_Free);
891-
DEAD(sub_st);
892-
PyStackRef_CLOSE(list_st);
893893
res = PyStackRef_FromPyObjectSteal(res_o);
894894
#else
895895
DEOPT_IF(index >= PyList_GET_SIZE(list));
896-
STAT_INC(BINARY_SUBSCR, hit);
897896
PyObject *res_o = PyList_GET_ITEM(list, index);
898897
assert(res_o != NULL);
899898
res = PyStackRef_FromPyObjectNew(res_o);
900-
DECREF_INPUTS();
901899
#endif
900+
STAT_INC(BINARY_SUBSCR, hit);
901+
DECREF_INPUTS();
902902
}
903903

904904
inst(BINARY_SUBSCR_STR_INT, (unused/1, str_st, sub_st -- res)) {

Python/executor_cases.c.h

Lines changed: 14 additions & 18 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: 14 additions & 18 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)