mirror of
https://github.com/python/cpython
synced 2024-10-14 17:59:38 +00:00
74613a46fc
Add inspect.get_annotations, which safely computes the annotations defined on an object. It works around the quirks of accessing the annotations from various types of objects, and makes very few assumptions about the object passed in. inspect.get_annotations can also correctly un-stringize stringized annotations. inspect.signature, inspect.from_callable, and inspect.from_function now call inspect.get_annotations to retrieve annotations. This means inspect.signature and inspect.from_callable can now un-stringize stringized annotations, too.
4 lines
60 B
Python
4 lines
60 B
Python
from __future__ import annotations
|
|
|
|
def foo(a, b, c): pass
|