[Python-checkins] bpo-44926: `get_type_hints`: Add note about type aliases with forward refs (#27859)

gvanrossum webhook-mailer at python.org
Fri Aug 20 10:37:00 EDT 2021


https://github.com/python/cpython/commit/16b9be4861e007ad483611ba0479feb2b90ea783
commit: 16b9be4861e007ad483611ba0479feb2b90ea783
branch: main
author: Maximilian Hils <git at maximilianhils.com>
committer: gvanrossum <gvanrossum at gmail.com>
date: 2021-08-20T07:36:51-07:00
summary:

bpo-44926: `get_type_hints`: Add note about type aliases with forward refs (#27859)

files:
M Doc/library/typing.rst

diff --git a/Doc/library/typing.rst b/Doc/library/typing.rst
index e8d7c9ee01bd1..47d6c3a2e3898 100644
--- a/Doc/library/typing.rst
+++ b/Doc/library/typing.rst
@@ -2013,6 +2013,13 @@ Introspection helpers
            'name': Annotated[str, 'some marker']
        }
 
+   .. note::
+
+      :func:`get_type_hints` does not work with imported
+      :ref:`type aliases <type-aliases>` that include forward references.
+      Enabling postponed evaluation of annotations (:pep:`563`) may remove
+      the need for most forward references.
+
    .. versionchanged:: 3.9
       Added ``include_extras`` parameter as part of :pep:`593`.
 



More information about the Python-checkins mailing list