GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — TypeAliasType objects have no `__qualname__` · Issue #139817 · python/cpython

TypeAliasType objects have no __qualname__ #139817

New issue
Copy link
New issue
Copy link
Closed
Closed
TypeAliasType objects have no __qualname__#139817
Copy link
Labels
interpreter-core(Objects, Python, Grammar, and Parser dirs)(Objects, Python, Grammar, and Parser dirs)topic-typingtype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error

Description

@AA-Turner
AA-Turner
opened on Oct 9, 2025
Issue body actions

Bug report

Bug description:

This means that introspection is worse for type statements declared e.g. within class bodies.

A

cc @JelleZijlstra

CPython versions tested on:

3.12, 3.13, 3.14, 3.15, CPython main branch

Operating systems tested on:

No response

Linked PRs

  • gh-139817: Attribute __qualname__ is added to TypeAliasType #139919
  • gh-139817: typing docs: Fix indentation of .. versionadded:: note for TypeAliasType.__qualname__ #140177
  • gh-139817: Fix refleak in TypeAliasType(qualname=non_string) #140197

Activity

  1. AA-Turner
    added
    type-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
    topic-typing
    on Oct 9, 2025
  2. efimov-mikhail commented on Oct 9, 2025

    @efimov-mikhail
    efimov-mikhail
    on Oct 9, 2025
    Member
    More actions

    I would like to make a PR for adding __qualname__, but maybe I'll be needed some guidance about it.

  3. JelleZijlstra commented on Oct 10, 2025

    @JelleZijlstra
    JelleZijlstra
    on Oct 10, 2025
    Member
    More actions

    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
  4. xuantengh commented on Oct 10, 2025

    @xuantengh
    xuantengh
    on Oct 10, 2025 · Hidden as off-topic
    show commentMore actions
  5. JelleZijlstra commented on Oct 10, 2025

    @JelleZijlstra
    JelleZijlstra
    on Oct 10, 2025
    Member
    More actions

    Vec[int] is an instance of types.GenericAlias, not TypeAliasType. It should not be part of this issue and should not have a __qualname__ attribute.

  6. picnixz
    added
    interpreter-core(Objects, Python, Grammar, and Parser dirs)(Objects, Python, Grammar, and Parser dirs)
    on Oct 10, 2025
  7. JelleZijlstra
    added a commit that references this issue on Oct 15, 2025

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

    f673f0e
  8. efimov-mikhail commented on Oct 15, 2025

    @efimov-mikhail
    efimov-mikhail
    on Oct 15, 2025
    Member
    More actions

    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?

  9. AlexWaygood
    added 2 commits that reference this issue on Oct 15, 2025

    pythongh-139817: Fix indentation of `.. versionadded::` note for `Typ…

    a5ffd27

    gh-139817: typing docs: Fix indentation of `.. versionadded::` note f…

    65d1a14
  10. JelleZijlstra commented on Oct 15, 2025

    @JelleZijlstra
    JelleZijlstra
    on Oct 15, 2025
    Member
    More actions

    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.

    Reacted by Alex Waygood and Mikhail Efimov
  11. JelleZijlstra
    closed this as completedon Oct 15, 2025
  12. minaminan22-dot commented on Oct 15, 2025

    @minaminan22-dot
    minaminan22-dot
    on Oct 15, 2025 · Hidden as spam
    show commentMore actions
  13. encukou
    added a commit that references this issue on Oct 16, 2025

    pythongh-139817: Fix refleak in TypeAliasType(qualname=non_string)

    8c46640
  14. encukou commented on Oct 16, 2025

    @encukou
    encukou
    on Oct 16, 2025
    Member
    More actions

    Commit f673f0e has a refleak. Fix in #140197.

  15. encukou
    reopened this on Oct 16, 2025
  16. encukou
    added a commit that references this issue on Oct 16, 2025

    gh-139817: Fix refleak in TypeAliasType(qualname=non_string) (GH-140197)

    ea4cc58
  17. JelleZijlstra commented on Oct 16, 2025

    @JelleZijlstra
    JelleZijlstra
    on Oct 16, 2025
    Member
    More actions

    Thanks, sorry for missing the refleak!

    Reacted by Mikhail Efimov
  18. JelleZijlstra
    closed this as completedon Oct 16, 2025
  19. encukou commented on Oct 16, 2025

    @encukou
    encukou
    on Oct 16, 2025
    Member
    More actions

    Thanks for the test that caught the refleak early :)

    Reacted by Mikhail Efimov
  20. StanFromIreland
    added 3 commits that reference this issue on Dec 6, 2025

    pythongh-139817: Attribute `__qualname__` is added to `TypeAliasType` (…

    13369a1

    pythongh-139817: typing docs: Fix indentation of `.. versionadded::` …

    cc3b0ec

    pythongh-139817: Fix refleak in TypeAliasType(qualname=non_string) (p…

    fe4b7b7
  21. hauntsaninja
    added a commit that references this issue on Apr 16, 2026

    Initial support for Python 3.15.0a8 (#21255)

    ebaa73a
  22. JukkaL
    added a commit that references this issue on Apr 21, 2026

    Initial support for Python 3.15.0a8 (#21255)

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    interpreter-core(Objects, Python, Grammar, and Parser dirs)(Objects, Python, Grammar, and Parser dirs)topic-typingtype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402503 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.