Skip to content

Commit e02a35c

Browse files
gh-134584: Cleanups for GH-135860 (GH-142604)
1 parent c98182b commit e02a35c

File tree

9 files changed

+41
-35
lines changed

9 files changed

+41
-35
lines changed

Include/internal/pycore_opcode_metadata.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.

Include/internal/pycore_uop_ids.h

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Include/internal/pycore_uop_metadata.h

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

Lib/test/test_capi/test_opt.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1938,8 +1938,7 @@ def testfunc(n):
19381938
self.assertIsNotNone(ex)
19391939
uops = get_opnames(ex)
19401940
self.assertIn("_CALL_TUPLE_1", uops)
1941-
# Re-enable later gh-134584
1942-
# self.assertIn("_POP_TOP_NOP", uops)
1941+
self.assertIn("_POP_TOP_NOP", uops)
19431942

19441943
def test_call_str_1(self):
19451944
def testfunc(n):

Python/bytecodes.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4068,15 +4068,17 @@ dummy_func(
40684068
DEOPT_IF(callable_o != (PyObject *)&PyTuple_Type);
40694069
}
40704070

4071-
op(_CALL_TUPLE_1, (callable, null, arg -- res)) {
4071+
op(_CALL_TUPLE_1, (callable, null, arg -- res, a)) {
40724072
PyObject *arg_o = PyStackRef_AsPyObjectBorrow(arg);
40734073

40744074
assert(oparg == 1);
40754075
STAT_INC(CALL, hit);
40764076
PyObject *res_o = PySequence_Tuple(arg_o);
4077-
PyStackRef_CLOSE(arg);
4077+
if (res_o == NULL) {
4078+
ERROR_NO_POP();
4079+
}
4080+
a = arg;
40784081
INPUTS_DEAD();
4079-
ERROR_IF(res_o == NULL);
40804082
res = PyStackRef_FromPyObjectSteal(res_o);
40814083
}
40824084

@@ -4086,6 +4088,7 @@ dummy_func(
40864088
_GUARD_NOS_NULL +
40874089
_GUARD_CALLABLE_TUPLE_1 +
40884090
_CALL_TUPLE_1 +
4091+
POP_TOP +
40894092
_CHECK_PERIODIC_AT_END;
40904093

40914094
op(_CHECK_AND_ALLOCATE_OBJECT, (type_version/2, callable, self_or_null, unused[oparg] -- callable, self_or_null, unused[oparg])) {

Python/executor_cases.c.h

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

Python/optimizer_bytecodes.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1097,7 +1097,7 @@ dummy_func(void) {
10971097
}
10981098
}
10991099

1100-
op(_CALL_TUPLE_1, (callable, null, arg -- res)) {
1100+
op(_CALL_TUPLE_1, (callable, null, arg -- res, a)) {
11011101
if (sym_matches_type(arg, &PyTuple_Type)) {
11021102
// e.g. tuple((1, 2)) or tuple(foo) where foo is known to be a tuple
11031103
// Note: we must strip the reference information because it goes
@@ -1107,6 +1107,7 @@ dummy_func(void) {
11071107
else {
11081108
res = sym_new_type(ctx, &PyTuple_Type);
11091109
}
1110+
a = arg;
11101111
}
11111112

11121113
op(_GUARD_TOS_LIST, (tos -- tos)) {

Python/optimizer_cases.c.h

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

0 commit comments

Comments
 (0)