mirror of
https://github.com/python/cpython.git
synced 2025-07-16 07:45:20 +00:00
gh-113297: Fix segfault in compiler for with statement with 19 context managers (#113327)
This commit is contained in:
parent
9afb0e1606
commit
c31943af16
3 changed files with 29 additions and 1 deletions
|
@ -648,7 +648,7 @@ mark_except_handlers(basicblock *entryblock) {
|
|||
|
||||
|
||||
struct _PyCfgExceptStack {
|
||||
basicblock *handlers[CO_MAXBLOCKS+1];
|
||||
basicblock *handlers[CO_MAXBLOCKS+2];
|
||||
int depth;
|
||||
};
|
||||
|
||||
|
@ -661,6 +661,7 @@ push_except_block(struct _PyCfgExceptStack *stack, cfg_instr *setup) {
|
|||
if (opcode == SETUP_WITH || opcode == SETUP_CLEANUP) {
|
||||
target->b_preserve_lasti = 1;
|
||||
}
|
||||
assert(stack->depth <= CO_MAXBLOCKS);
|
||||
stack->handlers[++stack->depth] = target;
|
||||
return target;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue