You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Local annotation turns local variables in cells #130924
Local variable annotations are supposed to be ignored by Python (they are used by static type checkers only),
so the addition of the annotation should not change the generated code.
The expected disassembly:
I can confirm that this is related to PEP-749. a:x introduces a child scope for __annotate__ and x is a free variable for that scope and this is poisonsx for the whole function.
Activity
gvanrossum commentedon Mar 6, 2025
Maybe @JelleZijlstra can look into this -- it smells like an unanticipated effect of PEP 749?
JelleZijlstra commentedon Mar 6, 2025
Yes, I already assigned it to myself to look into.
I think this is harmless in the sense that it doesn't change any behavior we should guarantee, but it's a pessimization.
sergey-miryanov commentedon Mar 21, 2025
I can confirm that this is related to PEP-749.
a:xintroduces a child scope for__annotate__andxis a free variable for that scope and this is poisonsxfor the whole function.pythongh-130924: Do not create cells for usages of names in local ann…
gh-130924: Do not create cells for usages of names in local annotatio…