You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
TypeAliasType objects have no __qualname__ #139817
There's two parts to this: adding a __qualname__ attribute to the TypeAliasType object (easy), and setting it correctly at runtime (hard). This will likely need changes to the bytecode, so that when we generate code for a type statement we pass the right qualname in. (Unless there's some clever way we can get it at runtime in the implementation of INTRINSIC_TYPEALIAS?) That probably means we can do it only in 3.15 at this point.
Reacted by Mikhail Efimov, Xuanteng Huang and JoBe
Qualified names for TypeAliasType have been added on main branch. So, this issue may be closed? Do we want to add qualified names for other typing objects or port them onto previous versions?
Thank you! We shouldn't backport this because it's a new feature, and if any other typing objects have similar issues, we should open a new issue. So that means we're done here.
Activity
efimov-mikhail commentedon Oct 9, 2025
I would like to make a PR for adding
__qualname__, but maybe I'll be needed some guidance about it.JelleZijlstra commentedon Oct 10, 2025
There's two parts to this: adding a
__qualname__attribute to the TypeAliasType object (easy), and setting it correctly at runtime (hard). This will likely need changes to the bytecode, so that when we generate code for atypestatement we pass the right qualname in. (Unless there's some clever way we can get it at runtime in the implementation of INTRINSIC_TYPEALIAS?) That probably means we can do it only in 3.15 at this point.xuantengh commentedon Oct 10, 2025
JelleZijlstra commentedon Oct 10, 2025
Vec[int]is an instance oftypes.GenericAlias, notTypeAliasType. It should not be part of this issue and should not have a__qualname__attribute.gh-139817: Attribute `__qualname__` is added to `TypeAliasType` (#139919
efimov-mikhail commentedon Oct 15, 2025
Qualified names for
TypeAliasTypehave been added on main branch. So, this issue may be closed? Do we want to add qualified names for other typing objects or port them onto previous versions?pythongh-139817: Fix indentation of `.. versionadded::` note for `Typ…
gh-139817: typing docs: Fix indentation of `.. versionadded::` note f…
JelleZijlstra commentedon Oct 15, 2025
Thank you! We shouldn't backport this because it's a new feature, and if any other typing objects have similar issues, we should open a new issue. So that means we're done here.
minaminan22-dot commentedon Oct 15, 2025
pythongh-139817: Fix refleak in TypeAliasType(qualname=non_string)
encukou commentedon Oct 16, 2025
Commit f673f0e has a refleak. Fix in #140197.
gh-139817: Fix refleak in TypeAliasType(qualname=non_string) (GH-140197)
JelleZijlstra commentedon Oct 16, 2025
Thanks, sorry for missing the refleak!
encukou commentedon Oct 16, 2025
Thanks for the test that caught the refleak early :)
pythongh-139817: Attribute `__qualname__` is added to `TypeAliasType` (…
pythongh-139817: typing docs: Fix indentation of `.. versionadded::` …
pythongh-139817: Fix refleak in TypeAliasType(qualname=non_string) (p…
Initial support for Python 3.15.0a8 (#21255)
Initial support for Python 3.15.0a8 (#21255)