mirror of
https://github.com/python/cpython.git
synced 2025-09-03 15:31:08 +00:00
Um, I thought I'd already checked this in.
Anyway, this is the changes to the with-statement so that __exit__ must return a true value in order for a pending exception to be ignored. The PEP (343) is already updated.
This commit is contained in:
parent
692cdbc5d6
commit
f669436189
11 changed files with 61 additions and 106 deletions
|
@ -1382,7 +1382,7 @@ opcode_stack_effect(int opcode, int oparg)
|
|||
case BREAK_LOOP:
|
||||
return 0;
|
||||
case WITH_CLEANUP:
|
||||
return 3;
|
||||
return -1; /* XXX Sometimes more */
|
||||
case LOAD_LOCALS:
|
||||
return 1;
|
||||
case RETURN_VALUE:
|
||||
|
@ -3472,8 +3472,6 @@ compiler_with(struct compiler *c, stmt_ty s)
|
|||
!compiler_nameop(c, tmpexit, Del))
|
||||
return 0;
|
||||
ADDOP(c, WITH_CLEANUP);
|
||||
ADDOP_I(c, CALL_FUNCTION, 3);
|
||||
ADDOP(c, POP_TOP);
|
||||
|
||||
/* Finally block ends. */
|
||||
ADDOP(c, END_FINALLY);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue