Skip to content

Narrow tuples of singletons#21610

Open
hauntsaninja wants to merge 2 commits into
python:masterfrom
hauntsaninja:dev
Open

Narrow tuples of singletons#21610
hauntsaninja wants to merge 2 commits into
python:masterfrom
hauntsaninja:dev

Conversation

@hauntsaninja

Copy link
Copy Markdown
Collaborator

Fixes #21598

@github-actions

Copy link
Copy Markdown
Contributor

Diff from mypy_primer, showing the effect of this PR on open source code:

CPython (Argument Clinic) (https://github.com/python/cpython)
+ Tools/clinic/libclinic/converter.py:216: error: Statement is unreachable  [unreachable]
@hauntsaninja

Copy link
Copy Markdown
Collaborator Author

Primer is a false positive. Here is a small repro:

def f(default: object, default_type: type[object] | tuple[type[object], ...]) -> None:
    reveal_type(default_type)
    if default_type == ():
        raise
    reveal_type(default_type)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

1 participant