Skip to content

Revert "add overload to tuple.__new__ to better express an empty tuple" #8278

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

Merged
merged 4 commits into from
Jul 12, 2022

Conversation

JelleZijlstra
Copy link
Member

Reverts #7454

Fixes #8275

@github-actions

This comment has been minimized.

@srittau
Copy link
Collaborator

srittau commented Jul 12, 2022

Maybe add a comment so we don't accidentally add it back?

@JelleZijlstra
Copy link
Member Author

Or better yet, a test case.

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.

I find the variadic-tuple-subclass case included as a test-case here much more clearly problematic than the specialised-tuple-subclass case discussed in the issue. Looks good.

@github-actions

This comment has been minimized.

1 similar comment
@github-actions
Copy link
Contributor

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

discord.py (https://github.com/Rapptz/discord.py)
+ discord/guild.py:545: error: Need type annotation for "empty_tuple"
- discord/ext/tasks/__init__.py:494: error: Incompatible types in assignment (expression has type "Tuple[]", variable has type "Tuple[Type[OSError], Type[GatewayNotFound], Type[ConnectionClosed], Type[ClientError], Type[TimeoutError]]")
+ discord/ext/tasks/__init__.py:494: error: Incompatible types in assignment (expression has type "Tuple[<nothing>, ...]", variable has type "Tuple[Type[OSError], Type[GatewayNotFound], Type[ConnectionClosed], Type[ClientError], Type[TimeoutError]]")

@JelleZijlstra JelleZijlstra merged commit 2a7439e into master Jul 12, 2022
@JelleZijlstra JelleZijlstra deleted the revert-7454-master branch July 12, 2022 19:29
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.

Recent change to tuple constructor breaks subclasses of tuples
3 participants