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
Commit d944e0a
Browse filesBrowse the repository at this point in the historyBrowse files
codegen: match CPython priority/location for nonlocal-global conflicts
The nonlocal-vs-global cross-check ran before the parameter, use,
annotation, and assignment checks in each symboltable arm, but CPython
3.14 runs it last:
- 'global x; print(x); nonlocal x' must report
"name 'x' is used prior to nonlocal declaration", not
"name 'x' is nonlocal and global"
- 'nonlocal x; x = 2; global x' must report
"name 'x' is assigned to before global declaration"
Move the cross-check to the bottom of the Global/Nonlocal arms.
Also keep the location of the first global/nonlocal directive instead
of overwriting it on each one, so a duplicated directive still points
at the first occurrence, matching CPython (this also fixes the
"no binding for nonlocal" location for duplicate directives).
Assisted-by: Kimi Code CLI
0 commit comments