Skip to content

LOAD_FAST_BORROW analysis kills some locals for opcodes which consume no inputs #138679

@DinoV

Description

@DinoV

Bug report

Bug description:

def f(self):
    if x:
        pass
    self.x
    with self.x:
        from shutil import ExecError

This produces a LOAD_FAST for the first self.x when it should produce a LOAD_FAST_BORROW. The IMPORT_FROM/STORE_FAST ends up marking self as STORED_AS_LOCAL

CPython versions tested on:

3.14

Operating systems tested on:

Linux

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    interpreter-core(Objects, Python, Grammar, and Parser dirs)type-bugAn unexpected behavior, bug, or error

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions