New submission from Raymond Hettinger <[email protected]>:
In the example below, __annotations__ is correct but not the corresponding
Signature object.
-----------------------------------------------------------------------
from typing import List
def f(s: List[float]) -> None: pass
def g(s: list[float]) -> None: pass
>>> inspect.signature(f)
<Signature (s: List[float]) -> None>
>>> inspect.signature(g)
<Signature (s: list) -> None>
g.__annotations__
{'s': list[float], 'return': None}
----------
components: Library (Lib)
messages: 403692
nosy: gvanrossum, levkivskyi, rhettinger
priority: normal
severity: normal
status: open
title: inspect not capturing type annotations created by __class_getitem__
versions: Python 3.10
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue45438>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com