Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

gh-139817: Attribute __qualname__ is added to TypeAliasType#139919

Merged
JelleZijlstra merged 8 commits into
python:mainpython/cpython:mainfrom
efimov-mikhail:issue-139817-type-alias-qualnameefimov-mikhail/cpython:issue-139817-type-alias-qualnameCopy head branch name to clipboard
Oct 15, 2025
Merged

gh-139817: Attribute __qualname__ is added to TypeAliasType#139919
JelleZijlstra merged 8 commits into
python:mainpython/cpython:mainfrom
efimov-mikhail:issue-139817-type-alias-qualnameefimov-mikhail/cpython:issue-139817-type-alias-qualnameCopy head branch name to clipboard

Conversation

@efimov-mikhail

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

Copy link
Copy Markdown
Member

@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
Copy Markdown
Member Author

CC @sobolevn

@efimov-mikhail

Copy link
Copy Markdown
Member Author

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

@JelleZijlstra JelleZijlstra left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks!

Comment thread Objects/typevarobject.c
Comment thread Objects/typevarobject.c
Comment thread Lib/test/test_type_aliases.py
@efimov-mikhail

Copy link
Copy Markdown
Member 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
Comment thread Objects/typevarobject.c Outdated
@efimov-mikhail

Copy link
Copy Markdown
Member Author

I've added new constructor parameter: X = TypeAliasType("X", int, qualname="foo.X"). It looks like there is no much extra complexity and this solution is OK. But we can provide another variant, if it's needed.

Comment thread Objects/typevarobject.c
@efimov-mikhail

efimov-mikhail commented Oct 15, 2025

Copy link
Copy Markdown
Member Author

Sorry for ping, @JelleZijlstra.

This PR could be merged, or I've missed something?

@JelleZijlstra JelleZijlstra merged commit f673f0e into python:main Oct 15, 2025
45 checks passed
@efimov-mikhail

Copy link
Copy Markdown
Member Author

Thanks!

StanFromIreland pushed a commit to StanFromIreland/cpython that referenced this pull request Dec 6, 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.

2 participants

Morty Proxy This is a proxified and sanitized view of the page, visit original site.