Skip to content

Conversation

efimov-mikhail
Copy link
Contributor

@efimov-mikhail efimov-mikhail commented Oct 10, 2025

@efimov-mikhail efimov-mikhail changed the title gh-139817: Parameter __qualname__ is added to TypeAliasType gh-139817: Attribute __qualname__ is added to TypeAliasType Oct 10, 2025
@efimov-mikhail
Copy link
Contributor Author

CC @sobolevn

@efimov-mikhail
Copy link
Contributor Author

I'm totally not sure that this solution is fully correct.
But it works in typical situations, and improves introspection.

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!

@efimov-mikhail
Copy link
Contributor Author

I've added some tests on __name__ and __qualname__, docs and news

@AlexWaygood AlexWaygood removed their request for review October 11, 2025 23:56
PyObject *ta = (PyObject *)typealias_alloc(name, checked_params, NULL, value,
module);

// It's impossible to determine qualname, so we use name instead.
Copy link
Member

Choose a reason for hiding this comment

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

Maybe we could make it a new constructor parameter: X = TypeAliasType("X", int, qualname="foo.X"). Probably not worth the extra complexity though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants