Skip to content

LOAD_FAST_BORROW; POP_TOP pairs should be removed #152600

Description

@brijkapadia

Feature or enhancement

Proposal:

I noticed that

def f(x):
    x

produces these instructions:

  3           RESUME                   0

  4           LOAD_FAST_BORROW         0 (x)
              POP_TOP
              LOAD_COMMON_CONSTANT     7 (None)
              RETURN_VALUE
Full reproducer

from dis import dis

def f(x):
    x

dis(f)

The compiler should get rid of any LOAD_FAST_BORROW; POP_TOP pairs.

I will work on this.

Has this already been discussed elsewhere?

This is a minor feature, which does not need previous discussion elsewhere

Links to previous discussion of this feature:

No response

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    interpreter-core(Objects, Python, Grammar, and Parser dirs)performancePerformance or resource usagetype-featureA feature request or enhancement
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions