cpython
cpython copied to clipboard
gh-99360: Avoid `exc=None; del exc` in bytecode where unnecessary
Functional changes:
DELETE_FASTnow assumes its argument is bound; it no longer raisesUnboundLocalErrorby itself.- When the state of a local is uncertain,
del xcompiles toLOAD_FAST_CHECK x; POP_TOP; DELETE_FAST x - At the end of an exception handler
except E as exc: ..., theexc=Nonebefore thedel excis omitted when not needed.
TODO: more tests, docs, NEWS
- Issue: gh-99360