Skip to content

Conversation

@JelleZijlstra
Copy link
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.
Copy link
Collaborator

@srittausrittau left a comment

Choose a reason for hiding this comment

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

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

Comment on lines +2440 to +2443
ifTYPING_3_11_0:
self.assertEqual(repr(Unpack[Ts]), '*Ts')
else:
self.assertEqual(repr(Unpack[Ts]), 'typing_extensions.Unpack[Ts]')
Copy link
Collaborator

Choose a reason for hiding this comment

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

(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
MemberAuthor

Choose a reason for hiding this comment

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

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
MemberAuthor

Choose a reason for hiding this comment

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

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

Choose a reason for hiding this comment

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

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
MemberAuthor

Choose a reason for hiding this comment

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

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

@mrahtz
Copy link

(Thanks, Jelle!)

@JelleZijlstraJelleZijlstra merged commit 783c8ca into python:masterApr 16, 2022
@JelleZijlstraJelleZijlstra deleted the 311test branch April 16, 2022 17:58
Sign up for freeto 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

@JelleZijlstra@mrahtz@srittau