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

Unnecessary specialization failures ofLOAD_ATTR andSTORE_ATTR when attributes are shadowed by the object's class. #123040

Closed
Labels
3.14bugs and security fixesinterpreter-core(Objects, Python, Grammar, and Parser dirs)performancePerformance or resource usage
@markshannon

Description

@markshannon

This applies to both instances and classes.
If an object and it's class both have attributes with the same name, this prevents specialization of access to the object's attribute.
However, in this case specialization should only be prevented if the class's attribute is a data descriptor.

Example 1, instance:

classC:x=1def__init__(self):self.x=2C().x

C().x above is2. It doesn't matter thatC.x exists, provided it isn't a data descriptor.
This failure shows up as "shadowed" in thestats

Example 2, class:

classMeta(type):x=1classC(metaclass=Meta):x=1C.x

C.x is2.Meta.x doesn't change that, as it isn't a data descriptor.
This failure shows up as "metaclass attribute" in thestats

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    3.14bugs and security fixesinterpreter-core(Objects, Python, Grammar, and Parser dirs)performancePerformance or resource usage

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp