8000 Feedback from code review · python/cpython@296bc08 · GitHub
[go: up one dir, main page]

Skip to content

Commit 296bc08

Browse files
committed
Feedback from code review
1 parent f085a2e commit 296bc08

File tree

9 files changed

+13
-15
lines changed

9 files changed

+13
-15
lines changed

Doc/library/dis.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -568,7 +568,7 @@ the original TOS1.
568568
Exception representation on the stack now consist of one, not three, items.
569569

570570

571-
.. opcode:: END_THROW
571+
.. opcode:: CLEANUP_THROW
572572

573573
Handles an exception raised during a :meth:`~generator.throw` or
574574
:meth:`~generator.close` call through the current frame. If TOS is an

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

Lib/importlib/_bootstrap_external.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -411,7 +411,7 @@ def _write_atomic(path, data, mode=0o666):
411411
# Python 3.12a1 3505 (Specialization/Cache for FOR_ITER)
412412
# Python 3.12a1 3506 (Add BINARY_SLICE and STORE_SLICE instructions)
413413
# Python 3.12a1 3507 (Set lineno of module's RESUME to 0)
414-
# Python 3.12a1 3508 (Add END_THROW)
414+
# Python 3.12a1 3508 (Add CLEANUP_THROW)
415415

416416
# Python 3.13 will start with 3550
417417

Lib/opcode.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ def pseudo_op(name, op, real_ops):
104104
def_op('BEFORE_ASYNC_WITH', 52)
105105
def_op('BEFORE_WITH', 53)
106106
def_op('END_ASYNC_FOR', 54)
107-
def_op('END_THROW', 55)
107+
def_op('CLEANUP_THROW', 55)
108108

109109
def_op('STORE_SUBSCR', 60)
110110
def_op('DELETE_SUBSCR', 61)

Lib/test/test_dis.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -507,9 +507,9 @@ async def _asyncwith(c):
507507
LOAD_CONST 0 (None)
508508
RETURN_VALUE
509509
510-
%3d >> END_THROW
510+
%3d >> CLEANUP_THROW
511511
JUMP_BACKWARD 24 (to 22)
512-
>> END_THROW
512+
>> CLEANUP_THROW
513513
JUMP_BACKWARD 9 (to 56)
514514
>> PUSH_EXC_INFO
515515
WITH_EXCEPT_START
@@ -519,7 +519,7 @@ async def _asyncwith(c):
519519
YIELD_VALUE 6
520520
RESUME 3
521521
JUMP_BACKWARD_NO_INTERRUPT 4 (to 82)
522-
>> END_THROW
522+
>> CLEANUP_THROW
523523
>> POP_JUMP_FORWARD_IF_TRUE 1 (to 96)
524524
RERAISE 2
525525
>> POP_TOP

Python/ceval.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2749,7 +2749,7 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, _PyInterpreterFrame *frame, int
27492749
}
27502750
}
27512751

2752-
TARGET(END_THROW) {
2752+
TARGET(CLEANUP_THROW) {
27532753
assert(throwflag);
27542754
PyObject *exc_value = TOP();
27552755
assert(exc_value && PyExceptionInstance_Check(exc_value));

Python/compile.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1234,7 +1234,7 @@ stack_effect(int opcode, int oparg, int jump)
12341234
return 0;
12351235
case END_ASYNC_FOR:
12361236
return -2;
1237-
case END_THROW:
1237+
case CLEANUP_THROW:
12381238
return -2;
12391239
case FORMAT_VALUE:
12401240
/* If there's a fmt_spec on the stack, we go from 2->1,
@@ -1957,15 +1957,13 @@ compiler_add_yield_from(struct compiler *c, int await)
19571957
// Set up a virtual try/except to handle when StopIteration is raised during
19581958
// a close or throw call. The only way YIELD_VALUE raises if they do!
19591959
ADDOP_JUMP(c, SETUP_FINALLY, fail);
1960-
RETURN_IF_FALSE(compiler_push_fblock(c, TRY_EXCEPT, send, NO_LABEL, NULL));
19611960
ADDOP_I(c, YIELD_VALUE, 0);
1962-
compiler_pop_fblock(c, TRY_EXCEPT, send);
19631961
ADDOP_NOLINE(c, POP_BLOCK);
19641962
ADDOP_I(c, RESUME, await ? 3 : 2);
19651963
ADDOP_JUMP(c, JUMP_NO_INTERRUPT, send);
19661964

19671965
USE_LABEL(c, fail);
1968-
ADDOP(c, END_THROW);
1966+
ADDOP(c, CLEANUP_THROW);
19691967

19701968
USE_LABEL(c, exit);
19711969
return 1;

Python/opcode_targets.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.

0 commit comments

Comments
 (0)
0