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

stubtest: do not require @disjoint_base if there are __slots__#19701

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
JelleZijlstra merged 2 commits intopython:masterfromJelleZijlstra:stubtest-slots
Aug 21, 2025

Conversation

@JelleZijlstra
Copy link
Member

No description provided.

ifis_disjoint_runtimeandnotstub.is_disjoint_base:
# Don't complain about missing @disjoint_base if there are __slots__, because
# in that case we can infer that it's a disjoint base.
ifis_disjoint_runtimeandnotstub.is_disjoint_baseandstub.slotsisNone:
Copy link
Member

Choose a reason for hiding this comment

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

__slots__ only make a class a disjoint base if__slots__ are set to a non-empty sequence:

>>>classFoo:...__slots__= ()...     >>>classBar:...__slots__= ()...     >>>classBaz(Foo,Bar):......

does this logic account for that?

Copy link
MemberAuthor

@JelleZijlstraJelleZijlstraAug 20, 2025
edited
Loading

Choose a reason for hiding this comment

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

Oh yes this is wrong, it also includes slots from parent classes.

AlexWaygood reacted with thumbs up emoji
ifis_disjoint_runtimeandnotstub.is_disjoint_base:
# Don't complain about missing @disjoint_base if there are __slots__, because
# in that case we can infer that it's a disjoint base.
ifis_disjoint_runtimeandnotstub.is_disjoint_baseandnotruntime.__dict__.get("__slots__"):
Copy link
Member

@AlexWaygoodAlexWaygoodAug 21, 2025
edited
Loading

Choose a reason for hiding this comment

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

if it's a disjoint base at runtime because it has__slots__, maybe we could change the error message to say "has__slots__ at runtime (making it a disjoint base), but doesn't have__slots__ in the stub"? And ideally tell the user what the__slots__ are at runtime.

Otherwise I worry we'll have contributors adding@disjoint_base to the stubs because a stubtest error message told them to, when actually they should be adding__slots__

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

The code now doesn't make you add@disjoint_base if there are__slots__. Instead stubtest (somewhere else) should just directly tell you to add__slots__.

Copy link
Member

Choose a reason for hiding this comment

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

ohh, I see, sorry! I misread

@JelleZijlstraJelleZijlstra merged commit30a5263 intopython:masterAug 21, 2025
13 checks passed
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

1 more reviewer

@AlexWaygoodAlexWaygoodAlexWaygood approved these changes

Reviewers whose approvals may not affect merge requirements

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

2 participants

@JelleZijlstra@AlexWaygood

[8]ページ先頭

©2009-2025 Movatter.jp