]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[3.9] bpo-41370: Add note about ForwardRefs and PEP585 generic types in docs (GH...
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Sun, 4 Apr 2021 15:36:21 +0000 (08:36 -0700)
committerGitHub <noreply@github.com>
Sun, 4 Apr 2021 15:36:21 +0000 (08:36 -0700)
(cherry picked from commit 2b5913b4ee5852a28ca1509478f5582beb3aff7b)

Co-authored-by: Ken Jin <28750310+Fidget-Spinner@users.noreply.github.com>
Automerge-Triggered-By: GH:gvanrossum
Doc/library/typing.rst

index 688564f1d24f5199579232869b4a27d5bb5a7a3f..b136da00a070ade97d4c05301c84d59b97391d49 100644 (file)
@@ -1710,10 +1710,15 @@ Introspection helpers
 .. class:: ForwardRef
 
    A class used for internal typing representation of string forward references.
-   For example, ``list["SomeClass"]`` is implicitly transformed into
-   ``list[ForwardRef("SomeClass")]``.  This class should not be instantiated by
+   For example, ``List["SomeClass"]`` is implicitly transformed into
+   ``List[ForwardRef("SomeClass")]``.  This class should not be instantiated by
    a user, but may be used by introspection tools.
 
+   .. note::
+      :pep:`585` generic types such as ``list["SomeClass"]`` will not be
+      implicitly transformed into ``list[ForwardRef("SomeClass")]`` and thus
+      will not automatically resolve to ``list[SomeClass]``.
+
    .. versionadded:: 3.7.4
 
 Constant