Skip to content

gh-148639: Implement PEP 800 (typing.disjoint_base)#148640

Merged
JelleZijlstra merged 7 commits intopython:mainfrom
JelleZijlstra:pep800
Apr 18, 2026
Merged

gh-148639: Implement PEP 800 (typing.disjoint_base)#148640
JelleZijlstra merged 7 commits intopython:mainfrom
JelleZijlstra:pep800

Conversation

@JelleZijlstra
Copy link
Copy Markdown
Member

@JelleZijlstra JelleZijlstra commented Apr 16, 2026

Comment thread Doc/library/typing.rst
Comment thread Lib/typing.py
Comment thread Doc/library/typing.rst
JelleZijlstra and others added 3 commits April 16, 2026 05:51
Co-authored-by: Victorien <65306057+Viicos@users.noreply.github.com>
Co-authored-by: Petr Viktorin <encukou@gmail.com>
Copy link
Copy Markdown
Member

@carljm carljm left a comment

Choose a reason for hiding this comment

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

LGTM, thank you!

Comment thread Lib/typing.py Outdated
"""This decorator marks a class as a disjoint base.

Child classes of a disjoint base cannot inherit from other disjoint bases that are
not parent classes of the disjoint base.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think we need to say "parent or child" here, not just "parent", similar to the documentation wording.

Comment thread Doc/library/typing.rst Outdated
Type checkers do not allow child classes of a disjoint base ``C`` to
inherit from other disjoint bases that are not parent or child classes of ``C``.

For example:
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think we either need a double colon here or a .. testcode:: directive, for this example to render properly?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Good call, double colon works

@JelleZijlstra JelleZijlstra merged commit 92164dc into python:main Apr 18, 2026
51 checks passed
@JelleZijlstra JelleZijlstra deleted the pep800 branch April 18, 2026 02:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants