FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Fix tests on Python 3.11 by JelleZijlstra · Pull Request #1139 · python/typing · GitHub

/ typing Public

Fix tests on Python 3.11 - #1139

Merged
JelleZijlstra merged 5 commits into
python:masterfrom
JelleZijlstra:311test
Apr 16, 2022
Merged

Fix tests on Python 3.11#1139
JelleZijlstra merged 5 commits into
python:masterfrom
JelleZijlstra:311test

Conversation

Copy link
Copy Markdown
Member

Tests pass for me on a 3.11 build from today now.

- Defer to the PEP 646 implementation in typing.py on 3.11
- Adjust some tests accordingly. Noted a bug in
  python/cpython#32341 (comment)
- typing._type_check() is more lenient in 3.11 and no longer rejects ints
- The representation of the empty tuple type changed

Tests pass for me on a 3.11 build from today now.
JelleZijlstra requested a review from srittau April 16, 2022 16:07

srittau left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

LGTM, although I have one concern that you can ignore if you wish.

Comment on lines +2440 to +2443
if TYPING_3_11_0:
self.assertEqual(repr(Unpack[Ts]), '*Ts')
else:
self.assertEqual(repr(Unpack[Ts]), 'typing_extensions.Unpack[Ts]')

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

(Which I forgot to save.)

Wouldn't it make more sense to make the typing_extensions version match the one from Python 3.11?

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.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Yes, I was thinking about that too. On the other hand, *Ts is a syntax error before 3.11, so it may not be very helpful as repr() output.

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.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

@mrahtz what do you think? Should we use *Ts in the repr() for Unpack even before 3.11?

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

I think I agree it should be Unpack[Ts] before 3.11 - isn't the repr() suppose to be as close as possible to something you can directly eval()?

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.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Thanks, then let's stick with the current behavior.

mrahtz commented Apr 16, 2022

Copy link
Copy Markdown

(Thanks, Jelle!)

JelleZijlstra merged commit 783c8ca into python:master Apr 16, 2022
JelleZijlstra deleted the 311test branch April 16, 2022 17:58
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
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.

3 participants


Back | FazBrowse Home | New Git URL