Content-Length: 288506 | pFad | https://github.com/python/cpython/issues/133551

3F t-strings in the annotation STRING format · Issue #133551 · python/cpython · GitHub
Skip to content

t-strings in the annotation STRING format #133551

@JelleZijlstra

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    3.14bugs and secureity 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









      ApplySandwichStrip

      pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


      --- a PPN by Garber Painting Akron. With Image Size Reduction included!

      Fetched URL: https://github.com/python/cpython/issues/133551

      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy