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

Refactor/unify access to static attributes#19254

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
ilevkivskyi merged 3 commits intopython:masterfromilevkivskyi:unify-static-attrs
Jun 9, 2025

Conversation

@ilevkivskyi
Copy link
Member

@ilevkivskyiilevkivskyi commentedJun 8, 2025
edited
Loading

Fixes#3832
Fixes#5723
Fixes#17174
Improves#7217

This is a sixth "major" PR toward#7724. Previously access to "static" attributes (like type aliases, class objects) was duplicated in four places:

  • Inanalyze_ref_expr()
  • Indetermine_type_of_member() (for modules as subtypes of protocols)
  • In instance attribute access logic
  • In class attribute logic

Most of these were somewhat incomplete and/or inconsistent, this PR unifies all four (there is still tiny duplication because I decided to limit the number of deferrals, i.e. preserve the existing logic in this respect). Some notable things that are not pure refactoring:

  • Previously we disabled access to type variables as class attributes. This was inconsistent with plain references and instance attributes that just returnInstance("typing.TypeVar").
  • Instance access plugins were only applied onTypeInfos andTypeAliases, now they are applied always.
  • Previously arguments kinds were sometimes not correct for TypedDict class objects with non-required keys.
  • I tweakedTypeOfAny in couple places to be more logical.

@ilevkivskyiilevkivskyi requested a review fromJukkaLJune 8, 2025 20:05
@github-actions

This comment has been minimized.

@github-actions
Copy link
Contributor

According tomypy_primer, this change doesn't affect type check results on a corpus of open source code. ✅

Copy link
Collaborator

@JukkaLJukkaL left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Nice to see more duplicate code paths getting merged!

@ilevkivskyiilevkivskyi merged commit929377a intopython:masterJun 9, 2025
19 checks passed
@ilevkivskyiilevkivskyi deleted the unify-static-attrs branchJune 9, 2025 14:36
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@JukkaLJukkaLJukkaL approved these changes

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

2 participants

@ilevkivskyi@JukkaL

[8]ページ先頭

©2009-2025 Movatter.jp