Skip to content

Commit ef9623a

Browse files
committed
Rename ENTER_WITH to BEGIN_WITH for consistency with BEFORE_ASYNC_WITH.
1 parent 1535786 commit ef9623a

File tree

5 files changed

+8
-8
lines changed

5 files changed

+8
-8
lines changed

Include/opcode.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ extern "C" {
3434
#define GET_AITER 50
3535
#define GET_ANEXT 51
3636
#define BEFORE_ASYNC_WITH 52
37-
#define ENTER_WITH 53
37+
#define BEFORE_WITH 53
3838
#define INPLACE_ADD 55
3939
#define INPLACE_SUBTRACT 56
4040
#define INPLACE_MULTIPLY 57

Lib/opcode.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ def jabs_op(name, op):
8989
def_op('GET_AITER', 50)
9090
def_op('GET_ANEXT', 51)
9191
def_op('BEFORE_ASYNC_WITH', 52)
92-
def_op('ENTER_WITH', 53)
92+
def_op('BEFORE_WITH', 53)
9393

9494
def_op('INPLACE_ADD', 55)
9595
def_op('INPLACE_SUBTRACT', 56)

Python/ceval.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -934,7 +934,7 @@ _PyEval_EvalFrameDefault(PyFrameObject *f, int throwflag)
934934
- If we're about the enter the body of a with statement
935935
having just called __enter__/__exit__, then make sure
936936
that the exception handler is pushed. Otherwise, we might
937-
not call __exit__ if an interrput occurs and just this moment.
937+
not call __exit__ if an interrupt occurs at just this moment.
938938
- If we're about to enter the try: of a try statement (not
939939
*very* useful, but might help in some cases and it's
940940
traditional)
@@ -2894,7 +2894,7 @@ _PyEval_EvalFrameDefault(PyFrameObject *f, int throwflag)
28942894
DISPATCH();
28952895
}
28962896

2897-
TARGET(ENTER_WITH) {
2897+
TARGET(BEFORE_WITH) {
28982898
/* Replace TOP with TOP.__exit__ and push the result
28992899
* of calling TOP.__enter__()
29002900
*/

Python/compile.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1029,7 +1029,7 @@ PyCompile_OpcodeStackEffect(int opcode, int oparg)
10291029
+ 3 others for the previous exception state
10301030
-1 for the context manager. */
10311031

1032-
case ENTER_WITH:
1032+
case BEFORE_WITH:
10331033
return 1;
10341034

10351035
case LOAD_FAST:
@@ -4538,7 +4538,7 @@ compiler_async_with(struct compiler *c, stmt_ty s, int pos)
45384538
is implemented as:
45394539
45404540
<code for EXPR>
4541-
ENTER_WITH
4541+
BEFORE_WITH
45424542
SETUP_WITH E
45434543
<code to store to VAR> or POP_TOP
45444544
<code for BLOCK>
@@ -4573,7 +4573,7 @@ compiler_with(struct compiler *c, stmt_ty s, int pos)
45734573
/* Evaluate EXPR */
45744574
VISIT(c, expr, item->context_expr);
45754575
/* Will push bound __exit__ */
4576-
ADDOP(c, ENTER_WITH);
4576+
ADDOP(c, BEFORE_WITH);
45774577
ADDOP_JREL(c, SETUP_WITH, final2);
45784578

45794579
if (item->optional_vars) {

Python/opcode_targets.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ static void *opcode_targets[256] = {
5252
&&TARGET_GET_AITER,
5353
&&TARGET_GET_ANEXT,
5454
&&TARGET_BEFORE_ASYNC_WITH,
55-
&&TARGET_ENTER_WITH,
55+
&&TARGET_BEFORE_WITH,
5656
&&_unknown_opcode,
5757
&&TARGET_INPLACE_ADD,
5858
&&TARGET_INPLACE_SUBTRACT,

0 commit comments

Comments
 (0)