Message 377437 - Python tracker

This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Content
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.