-
-
Notifications
You must be signed in to change notification settings - Fork 32.4k
gh-126085: Add tp_iter
to TypeAliasType to allow star unpacking
#127981
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
Conversation
Misc/NEWS.d/next/Core_and_Builtins/2024-12-15-16-56-26.gh-issue-126085.BvyEXk.rst
Outdated
Show resolved
Hide resolved
Co-authored-by: Bénédikt Tran <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mostly LGTM, with two comments.
Misc/NEWS.d/next/Core_and_Builtins/2024-12-15-16-56-26.gh-issue-126085.BvyEXk.rst
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, some nits.
Objects/typevarobject.c
Outdated
@@ -59,6 +59,9 @@ typedef struct { | |||
|
|||
#include "clinic/typevarobject.c.h" | |||
|
|||
#define typevartuple_iter unpack_iter |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we need these defines, just use unpack_iter
directly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was a suggestion from @ZeroIntensity to keep the naming more consistent. I can remove them though
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you remove them?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was complaining originally about the naming inconsistency, but in hindsight, it's probably better than the extra #define
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll remove them (and fix the conflict) later today :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed!
Co-authored-by: Jelle Zijlstra <[email protected]>
As @JelleZijlstra suggested, this simply adds a
tp_iter
slot that returnsUnpack[self]
, same as we do for TypeVarTuple.Feedback welcome!
📚 Documentation preview 📚: https://cpython-previews--127981.org.readthedocs.build/en/127981/library/typing.html#typing.TypeAliasType