[Python-checkins] gh-91491: Complete Whats New in 3.11 for typing (GH-92708)

miss-islington webhook-mailer at python.org
Thu May 19 10:26:12 EDT 2022


https://github.com/python/cpython/commit/611d43c2a49e7c2c35fc03b0f58570b07c41b0eb
commit: 611d43c2a49e7c2c35fc03b0f58570b07c41b0eb
branch: 3.11
author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com>
committer: miss-islington <31488909+miss-islington at users.noreply.github.com>
date: 2022-05-19T07:25:50-07:00
summary:

gh-91491: Complete Whats New in 3.11 for typing (GH-92708)


Fixes GH-91491

Co-authored-by: Shantanu <12621235+hauntsaninja at users.noreply.github.com>
Co-authored-by: Alex Waygood <Alex.Waygood at Gmail.com>
(cherry picked from commit 6b51773afd5658e15d23ce220f66fcc39c02dcae)

Co-authored-by: Jelle Zijlstra <jelle.zijlstra at gmail.com>

files:
M Doc/whatsnew/3.11.rst

diff --git a/Doc/whatsnew/3.11.rst b/Doc/whatsnew/3.11.rst
index 0cbb0ba77217f..1fd5b35695ee3 100644
--- a/Doc/whatsnew/3.11.rst
+++ b/Doc/whatsnew/3.11.rst
@@ -730,6 +730,12 @@ For major changes, see :ref:`new-feat-related-type-hints-311`.
   the given type. At runtime it simply returns the received value.
   (Contributed by Jelle Zijlstra in :gh:`90638`.)
 
+* :data:`typing.TypedDict` types can now be generic. (Contributed by
+  Samodya Abey in :gh:`89026`.)
+
+* :class:`~typing.NamedTuple` types can now be generic.
+  (Contributed by Serhiy Storchaka in :issue:`43923`.)
+
 * Allow subclassing of :class:`typing.Any`. This is useful for avoiding
   type checker errors related to highly dynamic class, such as mocks.
   (Contributed by Shantanu Jain in :gh:`91154`.)
@@ -743,11 +749,33 @@ For major changes, see :ref:`new-feat-related-type-hints-311`.
   to clear all registered overloads of a function.
   (Contributed by Jelle Zijlstra in :gh:`89263`.)
 
-* :data:`typing.TypedDict` subclasses can now be generic. (Contributed by
-  Samodya Abey in :gh:`89026`.)
+* The :meth:`__init__` method of :class:`~typing.Protocol` subclasses
+  is now preserved. (Contributed by Adrian Garcia Badarasco in :gh:`88970`.)
 
-* :class:`~typing.NamedTuple` subclasses can now be generic.
-  (Contributed by Serhiy Storchaka in :issue:`43923`.)
+* The representation of empty tuple types (``Tuple[()]``) is simplified.
+  This affects introspection, e.g. ``get_args(Tuple[()])`` now evaluates
+  to ``()`` instead of ``((),)``.
+  (Contributed by Serhiy Storchaka in :gh:`91137`.)
+
+* Loosen runtime requirements for type annotations by removing the callable
+  check in the private ``typing._type_check`` function. (Contributed by
+  Gregory Beauregard in :gh:`90802`.)
+
+* :func:`typing.get_type_hints` now supports evaluating strings as forward
+  references in :ref:`PEP 585 generic aliases <types-genericalias>`.
+  (Contributed by Niklas Rosenstein in :gh:`85542`.)
+
+* :func:`typing.get_type_hints` no longer adds :data:`~typing.Optional`
+  to parameters with ``None`` as a default. (Contributed by Nikita Sobolev
+  in :gh:`90353`.)
+
+* :func:`typing.get_type_hints` now supports evaluating bare stringified
+  :data:`~typing.ClassVar` annotations. (Contributed by Gregory Beauregard
+  in :gh:`90711`.)
+
+* :func:`typing.no_type_check` no longer modifies external classes and functions.
+  It also now correctly marks classmethods as not to be type checked. (Contributed
+  by Nikita Sobolev in :gh:`90729`.)
 
 
 tkinter
@@ -1236,6 +1264,10 @@ Deprecated
   wherever possible.
   (Contributed by Alex Waygood in :gh:`92332`.)
 
+* The keyword argument syntax for constructing :data:`~typing.TypedDict` types
+  is now deprecated. Support will be removed in Python 3.13. (Contributed by
+  Jingchen Ye in :gh:`90224`.)
+
 
 Pending Removal in Python 3.12
 ==============================



More information about the Python-checkins mailing list