Skip to content

t-strings in the annotation STRING format #133551

Closed

Description

@JelleZijlstra

Bug report

Bug description:

Currently t-strings are not recovered correctly in the STRING format in annotations:

>>> def f(x: t"a{int}"): pass
... 
>>> import annotationlib
>>> annotationlib.get_annotations(f, format=annotationlib.Format.STRING)
{'x': "Template(strings=('a', ''), interpolations=(Interpolation(int, 'int', None, ''),))"}

I think we can do better there.

CPython versions tested on:

3.14

Operating systems tested on:

No response

Linked PRs

Activity

  1. added a commit that references this issue on May 7, 2025
  2. added
    interpreter-core(Objects, Python, Grammar, and Parser dirs)
    3.14bugs and security fixes
    stdlibStandard Library Python modules in the Lib/ directory
    and removed
    interpreter-core(Objects, Python, Grammar, and Parser dirs)
    on May 7, 2025
  3. added a commit that references this issue on May 8, 2025
  4. added a commit that references this issue on May 8, 2025
  5. added 3 commits that reference this issue on May 8, 2025
  6. added a commit that references this issue on May 8, 2025
  7. added a commit that references this issue on May 8, 2025
  8. added 2 commits that reference this issue on Jul 12, 2025
  9. added a commit that references this issue on Aug 4, 2025
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

    3.14bugs and security fixesstdlibStandard Library Python modules in the Lib/ directorytopic-typingtype-bugAn unexpected behavior, bug, or error

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions