cpython icon indicating copy to clipboard operation
cpython copied to clipboard

gh-99360: Avoid `exc=None; del exc` in bytecode where unnecessary

Open sweeneyde opened this issue 3 years ago • 0 comments

Functional changes:

  • DELETE_FAST now assumes its argument is bound; it no longer raises UnboundLocalError by itself.
  • When the state of a local is uncertain, del x compiles to LOAD_FAST_CHECK x; POP_TOP; DELETE_FAST x
  • At the end of an exception handler except E as exc: ..., the exc=None before the del exc is omitted when not needed.

TODO: more tests, docs, NEWS

  • Issue: gh-99360

sweeneyde avatar Nov 11 '22 04:11 sweeneyde