Skip to content

Conversation

tomasr8
Copy link
Member

@tomasr8 tomasr8 commented Dec 16, 2024

As @JelleZijlstra suggested, this simply adds a tp_iter slot that returns Unpack[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

@tomasr8 tomasr8 requested a review from AlexWaygood as a code owner December 16, 2024 20:22
Copy link
Member

@ZeroIntensity ZeroIntensity left a 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.

Copy link
Member

@ZeroIntensity ZeroIntensity left a comment

Choose a reason for hiding this comment

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

Thanks!

Copy link
Member

@Eclips4 Eclips4 left a comment

Choose a reason for hiding this comment

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

Thank you!

Copy link
Member

@JelleZijlstra JelleZijlstra left a comment

Choose a reason for hiding this comment

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

Thanks, some nits.


#include "clinic/typevarobject.c.h"

#define typevartuple_iter unpack_iter
Copy link
Member

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.

Copy link
Member Author

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

Copy link
Member

Choose a reason for hiding this comment

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

Could you remove them?

Copy link
Member

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.

Copy link
Member Author

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 :)

Copy link
Member Author

Choose a reason for hiding this comment

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

Removed!

@tomasr8 tomasr8 requested a review from JelleZijlstra January 30, 2025 10:20
@JelleZijlstra JelleZijlstra merged commit e091520 into python:main Mar 4, 2025
42 checks passed
@tomasr8 tomasr8 deleted the type-alias-iter branch March 5, 2025 06:45
seehwan pushed a commit to seehwan/cpython that referenced this pull request Apr 16, 2025
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.

5 participants