[issue45438] inspect not capturing type annotations created by __class_getitem__
Raymond Hettinger
report at bugs.python.org
Mon Oct 11 18:05:54 EDT 2021
New submission from Raymond Hettinger <raymond.hettinger at gmail.com>:
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 <report at bugs.python.org>
<https://bugs.python.org/issue45438>
_______________________________________
More information about the Python-bugs-list
mailing list