Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
py/compile: Optimize code generated for "except Exc as var:".
When such a clause is used (unlike just "except Exc:"), CPython wraps exception handler body in try-finally block, and in the finally part, executes "var = None; del var". The initial assignments appears to be superfluous with the successive "del". It's there only to cover a case when exeception handler would contain "del var" itself. Thus, compiler- generated code would recreate the var and then delete again, to avoid any spurious exception. Such a code would be rare, so avoid generating assignment unless MICROPY_CPYTHON_COMPAT is defined. Change-Id: I9a71821e394f87ff4153ae7c016e7d300147c429
- Loading branch information