Skip to content

Preserve chained assignments before fused local stores - #1

Open
EiNSTeiN- wants to merge 4 commits into
ejfkdev:mainfrom
EiNSTeiN-:fix/fused-store-assignment-chains
Open

EiNSTeiN- wants to merge 4 commits into
ejfkdev:mainfrom
EiNSTeiN-:fix/fused-store-assignment-chains

Conversation

@EiNSTeiN-

@EiNSTeiN- EiNSTeiN- commented Oct 13, 2026 •

Copy link
Copy Markdown

I am opening this PR to fix chained assignments followed by fused local stores in pycdc. The code below fails to decompile correctly from Python 3.13 and 3.14 bytecode and succeeds with this change:

def select(read):
    a = b = c = d = read()
    return a, b, c, d

Variations include three through six targets and a constant None instead of read(). A genuine chain evaluates its right-hand side once and gives every target that same object. The parser already understands chained assignment, but fails to recognize a following STORE_FAST_STORE_FAST as a store; it can consequently classify a COPY sequence as an expression operation and lose the chain. Adding that opcode to the existing store predicate is the entire production change, in the COPY/assignment lookahead.

STORE_FAST_STORE_FAST was introduced in Python 3.13, rather than 3.14, as recorded in the Python opcode documentation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant