mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
* Backport 937cebc93
to 3.10
* Update importlib
This commit is contained in:
parent
84d80f5f30
commit
cea0585b79
4 changed files with 2914 additions and 2859 deletions
|
@ -1767,7 +1767,6 @@ static int
|
|||
compiler_unwind_fblock(struct compiler *c, struct fblockinfo *info,
|
||||
int preserve_tos)
|
||||
{
|
||||
int loc;
|
||||
switch (info->fb_type) {
|
||||
case WHILE_LOOP:
|
||||
case EXCEPTION_HANDLER:
|
||||
|
@ -1820,7 +1819,6 @@ compiler_unwind_fblock(struct compiler *c, struct fblockinfo *info,
|
|||
|
||||
case WITH:
|
||||
case ASYNC_WITH:
|
||||
loc = c->u->u_lineno;
|
||||
SET_LOC(c, (stmt_ty)info->fb_datum);
|
||||
ADDOP(c, POP_BLOCK);
|
||||
if (preserve_tos) {
|
||||
|
@ -1835,7 +1833,10 @@ compiler_unwind_fblock(struct compiler *c, struct fblockinfo *info,
|
|||
ADDOP(c, YIELD_FROM);
|
||||
}
|
||||
ADDOP(c, POP_TOP);
|
||||
c->u->u_lineno = loc;
|
||||
/* The exit block should appear to execute after the
|
||||
* statement causing the unwinding, so make the unwinding
|
||||
* instruction artificial */
|
||||
c->u->u_lineno = -1;
|
||||
return 1;
|
||||
|
||||
case HANDLER_CLEANUP:
|
||||
|
@ -2986,12 +2987,17 @@ compiler_return(struct compiler *c, stmt_ty s)
|
|||
if (preserve_tos) {
|
||||
VISIT(c, expr, s->v.Return.value);
|
||||
} else {
|
||||
/* Emit instruction with line number for expression */
|
||||
/* Emit instruction with line number for return value */
|
||||
if (s->v.Return.value != NULL) {
|
||||
SET_LOC(c, s->v.Return.value);
|
||||
ADDOP(c, NOP);
|
||||
}
|
||||
}
|
||||
if (s->v.Return.value == NULL || s->v.Return.value->lineno != s->lineno) {
|
||||
SET_LOC(c, s);
|
||||
ADDOP(c, NOP);
|
||||
}
|
||||
|
||||
if (!compiler_unwind_fblock_stack(c, preserve_tos, NULL))
|
||||
return 0;
|
||||
if (s->v.Return.value == NULL) {
|
||||
|
@ -3010,6 +3016,8 @@ static int
|
|||
compiler_break(struct compiler *c)
|
||||
{
|
||||
struct fblockinfo *loop = NULL;
|
||||
/* Emit instruction with line number */
|
||||
ADDOP(c, NOP);
|
||||
if (!compiler_unwind_fblock_stack(c, 0, &loop)) {
|
||||
return 0;
|
||||
}
|
||||
|
@ -3028,6 +3036,8 @@ static int
|
|||
compiler_continue(struct compiler *c)
|
||||
{
|
||||
struct fblockinfo *loop = NULL;
|
||||
/* Emit instruction with line number */
|
||||
ADDOP(c, NOP);
|
||||
if (!compiler_unwind_fblock_stack(c, 0, &loop)) {
|
||||
return 0;
|
||||
}
|
||||
|
|
3352
Python/importlib.h
generated
3352
Python/importlib.h
generated
File diff suppressed because it is too large
Load diff
2357
Python/importlib_external.h
generated
2357
Python/importlib_external.h
generated
File diff suppressed because it is too large
Load diff
Loading…
Add table
Add a link
Reference in a new issue