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

Infer empty list without annotation for__slots__ and module__all__#19348

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

Conversation

@sterliakov
Copy link
Collaborator

@sterliakovsterliakov commentedJun 26, 2025
edited
Loading

Fixes#10870,fixes#10103.

This adds a fakeIterable[str] context when checking the following:

  • __all__ = [] at top level
  • __slots__ = [] at class level (also works for sets but not for dicts)

Additionally, this fixes a bug with__slots__ being mistakenly checked in other contexts (at top level or in function bodies), so e.g. the following is now accepted:

deffoo()->None:__slots__=1

smheidrich reacted with thumbs up emojismheidrich reacted with heart emojismheidrich reacted with rocket emoji
@sterliakovsterliakov changed the titleInfer empty list without annotation in__slots__Infer empty list without annotation for__slots__Jun 26, 2025
@sterliakovsterliakov changed the titleInfer empty list without annotation for__slots__Infer empty list without annotation for__slots__ and module__all__Jun 27, 2025
@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

Copy link
Member

@sobolevnsobolevn left a comment

Choose a reason for hiding this comment

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

Thank you!

@github-actions
Copy link
Contributor

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

@JukkaLJukkaL merged commit1091321 intopython:masterJul 9, 2025
19 checks passed
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@sobolevnsobolevnsobolevn approved these changes

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Mypy complains when[] is used for__slots__ definition Mypy complains about empty __all__ being untyped

3 participants

@sterliakov@sobolevn@JukkaL

[8]ページ先頭

©2009-2025 Movatter.jp