Skip to content
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PEP 604: Remove some more uses of Union/Optional #7515

Merged
merged 5 commits into from
Mar 19, 2022

Conversation

JelleZijlstra
Copy link
Member

Mypy seems fine with these. Aliases that use type[] or variadic tuple[]
still break mypy.

Mypy seems fine with these. Aliases that use type[] or variadic tuple[]
still break mypy.
@AlexWaygood
Copy link
Member

AlexWaygood commented Mar 19, 2022

Some of these mypy is cool with on >= 3.10, but can't handle on <3.10.

(I'm planning to write up bug reports soon; haven't got round to it yet.)

@github-actions

This comment has been minimized.

@JelleZijlstra
Copy link
Member Author

JelleZijlstra commented Mar 19, 2022

Right. Looks like these are the patterns:

  1. type[] at top level fails
  2. tuple[T1, T2] at top level fails (but tuple[T1, ...] is fine)
  3. T1 | Callable[..., T2 | T3] fails, but only <=3.9

Still ended up with a few fixes. I didn't look at @python2.

@github-actions

This comment has been minimized.

@AlexWaygood
Copy link
Member

AlexWaygood commented Mar 19, 2022

Right. Looks like these are the patterns:

  1. type[] at top level fails
  2. tuple[T1, T2] at top level fails (but tuple[T1, ...] is fine)
  3. T1 | Callable[..., T2 | T3] fails, but only <=3.9

Still ended up with a few fixes. I didn't look at @python2.

Of these, as far as I'm aware, only (2) is tracked over at mypy (in python/mypy#11098); (1) and (3) need to have bug reports filed.

(3) is obviously only relevant to stub files, as it isn't valid syntax in .py files in Python <3.10. That's probably why it hasn't been reported yet.

@github-actions

This comment has been minimized.

1 similar comment
@github-actions

This comment has been minimized.

@AlexWaygood AlexWaygood changed the title PEP 604: Remove some more uses of Union PEP 604: Remove some more uses of Union/Optional Mar 19, 2022
@github-actions
Copy link
Contributor

According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉

Copy link
Member

@AlexWaygood AlexWaygood left a comment

Choose a reason for hiding this comment

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

LGTM

@JelleZijlstra
Copy link
Member Author

I created https://github.com/python/mypy/labels/topic-pep-604 so we can track these better. Going to spend some time today organizing the mypy issue tracker.

@JelleZijlstra JelleZijlstra merged commit b7d129f into python:master Mar 19, 2022
@JelleZijlstra JelleZijlstra deleted the pep604 branch March 19, 2022 15:23
@AlexWaygood
Copy link
Member

AlexWaygood commented Mar 19, 2022

I created https://github.com/python/mypy/labels/topic-pep-604 so we can track these better. Going to spend some time today organizing the mypy issue tracker.

python/mypy#11887 (fixed for stubs but not for .py files) could do with that label being added 👍

@JelleZijlstra
Copy link
Member Author

Thanks!

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.

2 participants