Skip to content

inspect.formatannotation should use fully qualified name for type aliases #157954

Description

@JelleZijlstra

Feature or enhancement

Bug description:

This is inconsistent:

>>> import inspect
>>> type T = int
>>> class C: pass
... 
>>> inspect.formatannotation(T)
'T'
>>> inspect.formatannotation(C)
'__main__.C'

CPython versions tested on:

CPython main branch

Operating systems tested on:

No response

Linked PRs

Activity

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

    stdlibStandard Library Python modules in the Lib/ directorytopic-typingtype-featureA feature request or enhancement

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions