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
Expected output is "a", but on Python 3.11, it prints "self". This happens when both self and the variable are cell vars (e.g., when they are used in a generator expression).
The line name_index -= code.co_nlocals assumes that code.co_cellvars does not contains any local variable but this is not the case if self is also a cell var. The code object provides a _varname_from_oparg internal method and I wonder if it is a better choice for inferring variable names.
The text was updated successfully, but these errors were encountered:
This fixes the following issues:
- on Python 3.10 and earlier, storing to free variables is now handled
correctly
- on Python 3.11, `_varname_from_oparg` is now used, fixing problems
with cell variables that are also arguments
- on all supported versions, EXTENDED_ARG is now parsed, ensuring proper
handling for long functions
Fixesamaranth-lang#792.
This fixes the following issues:
- on Python 3.10 and earlier, storing to free variables is now handled
correctly
- on Python 3.11, `_varname_from_oparg` is now used, fixing problems
with cell variables that are also arguments
- on all supported versions, EXTENDED_ARG is now parsed, ensuring proper
handling for long functions
Fixes#792.
lethalbit
pushed a commit
to shrine-maiden-heavy-industries/torii-hdl
that referenced
this issue
Jun 10, 2023
This fixes the following issues:
- on Python 3.10 and earlier, storing to free variables is now handled
correctly
- on Python 3.11, `_varname_from_oparg` is now used, fixing problems
with cell variables that are also arguments
- on all supported versions, EXTENDED_ARG is now parsed, ensuring proper
handling for long functions
Fixesamaranth-lang#792.
Expected output is "a", but on Python 3.11, it prints "self". This happens when both self and the variable are cell vars (e.g., when they are used in a generator expression).
The line
name_index -= code.co_nlocals
assumes thatcode.co_cellvars
does not contains any local variable but this is not the case if self is also a cell var. The code object provides a_varname_from_oparg
internal method and I wonder if it is a better choice for inferring variable names.The text was updated successfully, but these errors were encountered: