Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

compiler can incorrectly optimize a run of stores to the same name preceded by a SWAP #104615

Closed
Assignees
carljm
Labels
3.11only security fixes3.12only security fixesinterpreter-core(Objects, Python, Grammar, and Parser dirs)release-blockertype-bugAn unexpected behavior, bug, or error
@carljm

Description

@carljm

If theapply_static_swaps optimization in the compiler sees the instruction sequenceSWAP 2; STORE_FAST a; STORE_FAST a, it will optimize that by removing theSWAP and swapping the two instructions, resulting inSTORE_FAST a; STORE_FAST a.

But of course, in this case the two instructions are identical, and their ordering matters because they store to the same location. So this change results in the wrong value being stored toa.

This was exposed by comprehension inlining, since it can result in this bytecode sequence for code in the forma = [1 for a in [0]] (where the firstSTORE_FAST a is restoring the previous value ofa from before the comprehension, if any, and the secondSTORE_FAST a is storing the result of the comprehension toa.).

Linked PRs

Metadata

Metadata

Assignees

Labels

3.11only security fixes3.12only security fixesinterpreter-core(Objects, Python, Grammar, and Parser dirs)release-blockertype-bugAn unexpected behavior, bug, or error

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions


    [8]ページ先頭

    ©2009-2025 Movatter.jp