summaryrefslogtreecommitdiffstats
path: root/Doc/library/typing.rst
diff options
context:
space:
mode:
authorJelle Zijlstra <jelle.zijlstra@gmail.com>2022-01-12 19:38:25 (GMT)
committerGitHub <noreply@github.com>2022-01-12 19:38:25 (GMT)
commit0bbf30e2b910bc9c5899134ae9d73a8df968da35 (patch)
treec1b8846dd8be0686cea098ea10ce2cf4c4abb2fd /Doc/library/typing.rst
parente34c9367f8e0068ca4bcad9fb5c2c1024d02a77d (diff)
downloadcpython-0bbf30e2b910bc9c5899134ae9d73a8df968da35.zip
cpython-0bbf30e2b910bc9c5899134ae9d73a8df968da35.tar.gz
cpython-0bbf30e2b910bc9c5899134ae9d73a8df968da35.tar.bz2
bpo-46342: make @typing.final introspectable (GH-30530)
Co-authored-by: Ken Jin <28750310+Fidget-Spinner@users.noreply.github.com>
Diffstat (limited to 'Doc/library/typing.rst')
-rw-r--r--Doc/library/typing.rst9
1 files changed, 9 insertions, 0 deletions
diff --git a/Doc/library/typing.rst b/Doc/library/typing.rst
index de7aa08..cb14db9 100644
--- a/Doc/library/typing.rst
+++ b/Doc/library/typing.rst
@@ -1985,6 +1985,15 @@ Functions and decorators
.. versionadded:: 3.8
+ .. versionchanged:: 3.11
+ The decorator will now set the ``__final__`` attribute to ``True``
+ on the decorated object. Thus, a check like
+ ``if getattr(obj, "__final__", False)`` can be used at runtime
+ to determine whether an object ``obj`` has been marked as final.
+ If the decorated object does not support setting attributes,
+ the decorator returns the object unchanged without raising an exception.
+
+
.. decorator:: no_type_check
Decorator to indicate that annotations are not type hints.