[issue39934] Fatal Python error "XXX block stack overflow" when exception stacks >10

Serhiy Storchaka report at bugs.python.org
Thu Sep 24 02:59:53 EDT 2020


Serhiy Storchaka <storchaka+cpython at gmail.com> added the comment:

It is a bug. Compiler explicitly checks if the number of nested "try" blocks does not exceed the limit of CO_MAXBLOCKS, but it does not count implicit "try" blocks inserted when your assign an exception in the "except" clause.

    try:
        ...
    except Exception as e:
        ...

is actually translated to

    try:
        ...
    except Exception:
        try:
            e = ...
            ...
        finally:
            e = None
            del e

So we have double number of nested "try" blocks.

----------
nosy: +Mark.Shannon, serhiy.storchaka
type: behavior -> crash
versions: +Python 3.10, Python 3.8, Python 3.9 -Python 3.7

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue39934>
_______________________________________


More information about the Python-bugs-list mailing list