aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/Doc/library/annotationlib.rst
diff options
context:
space:
mode:
Diffstat (limited to 'Doc/library/annotationlib.rst')
-rw-r--r--Doc/library/annotationlib.rst30
1 files changed, 17 insertions, 13 deletions
diff --git a/Doc/library/annotationlib.rst b/Doc/library/annotationlib.rst
index a96f5167c02..7dfc11449a6 100644
--- a/Doc/library/annotationlib.rst
+++ b/Doc/library/annotationlib.rst
@@ -127,16 +127,27 @@ Classes
Values are the result of evaluating the annotation expressions.
- .. attribute:: FORWARDREF
+ .. attribute:: VALUE_WITH_FAKE_GLOBALS
:value: 2
+ Special value used to signal that an annotate function is being
+ evaluated in a special environment with fake globals. When passed this
+ value, annotate functions should either return the same value as for
+ the :attr:`Format.VALUE` format, or raise :exc:`NotImplementedError`
+ to signal that they do not support execution in this environment.
+ This format is only used internally and should not be passed to
+ the functions in this module.
+
+ .. attribute:: FORWARDREF
+ :value: 3
+
Values are real annotation values (as per :attr:`Format.VALUE` format)
for defined values, and :class:`ForwardRef` proxies for undefined
values. Real objects may contain references to :class:`ForwardRef`
proxy objects.
.. attribute:: STRING
- :value: 3
+ :value: 4
Values are the text string of the annotation as it appears in the
source code, up to modifications including, but not restricted to,
@@ -144,17 +155,6 @@ Classes
The exact values of these strings may change in future versions of Python.
- .. attribute:: VALUE_WITH_FAKE_GLOBALS
- :value: 4
-
- Special value used to signal that an annotate function is being
- evaluated in a special environment with fake globals. When passed this
- value, annotate functions should either return the same value as for
- the :attr:`Format.VALUE` format, or raise :exc:`NotImplementedError`
- to signal that they do not support execution in this environment.
- This format is only used internally and should not be passed to
- the functions in this module.
-
.. versionadded:: 3.14
.. class:: ForwardRef
@@ -211,6 +211,10 @@ Classes
means may not have any information about their scope, so passing
arguments to this method may be necessary to evaluate them successfully.
+ If no *owner*, *globals*, *locals*, or *type_params* are provided and the
+ :class:`~ForwardRef` does not contain information about its origin,
+ empty globals and locals dictionaries are used.
+
.. versionadded:: 3.14