]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-133601: Remove deprecated `typing.no_type_check_decorator` (#133602)
authorsobolevn <mail@sobolevn.me>
Mon, 20 Oct 2025 21:10:44 +0000 (00:10 +0300)
committerGitHub <noreply@github.com>
Mon, 20 Oct 2025 21:10:44 +0000 (21:10 +0000)
Doc/deprecations/pending-removal-in-3.15.rst
Doc/library/typing.rst
Doc/whatsnew/3.13.rst
Doc/whatsnew/3.15.rst
Lib/test/test_typing.py
Lib/typing.py
Misc/NEWS.d/3.13.0a1.rst
Misc/NEWS.d/next/Library/2025-05-07-22-09-28.gh-issue-133601.9kUL3P.rst [new file with mode: 0644]

index 076346be6215690f05725717cbfc1ad7ecfc456f..09cbd6f01a0580f28a8235019824c1a1e5791fb1 100644 (file)
@@ -92,7 +92,7 @@ Pending removal in Python 3.15
     Use ``class TD(TypedDict): pass`` or ``TD = TypedDict("TD", {})``
     to create a TypedDict with zero field.
 
-  * The :func:`typing.no_type_check_decorator` decorator function
+  * The :func:`!typing.no_type_check_decorator` decorator function
     has been deprecated since Python 3.13.
     After eight years in the :mod:`typing` module,
     it has yet to be supported by any major type checker.
index e5d116c702ea2eddfe610f0b2c1af56a3389fa46..58f3a8ecd7c2e0cd4843ab8ddff7201d537058f7 100644 (file)
@@ -3258,17 +3258,6 @@ Functions and decorators
 
    ``@no_type_check`` mutates the decorated object in place.
 
-.. decorator:: no_type_check_decorator
-
-   Decorator to give another decorator the :func:`no_type_check` effect.
-
-   This wraps the decorator with something that wraps the decorated
-   function in :func:`no_type_check`.
-
-   .. deprecated-removed:: 3.13 3.15
-      No type checker ever added support for ``@no_type_check_decorator``. It
-      is therefore deprecated, and will be removed in Python 3.15.
-
 .. decorator:: override
 
    Decorator to indicate that a method in a subclass is intended to override a
@@ -4114,10 +4103,6 @@ convenience. This is subject to change, and not all deprecations are listed.
      - 3.12
      - Undecided
      - :pep:`695`
-   * - :func:`@typing.no_type_check_decorator <no_type_check_decorator>`
-     - 3.13
-     - 3.15
-     - :gh:`106309`
    * - :data:`typing.AnyStr`
      - 3.13
      - 3.18
index 499f6f0ff4eaca20ebca47a84ed165e26a14e81a..dc105156f33080daad4e4198c4de46d96753e522 100644 (file)
@@ -1993,7 +1993,7 @@ New Deprecations
     use ``class TD(TypedDict): pass`` or ``TD = TypedDict("TD", {})``.
     (Contributed by Alex Waygood in :gh:`105566` and :gh:`105570`.)
 
-  * Deprecate the :func:`typing.no_type_check_decorator` decorator function,
+  * Deprecate the :func:`!typing.no_type_check_decorator` decorator function,
     to be removed in Python 3.15.
     After eight years in the :mod:`typing` module,
     it has yet to be supported by any major type checker.
index 231ae565192efe6cea865529c607381455528423..d406b263f174e349ee64cf05cde5772853380a1d 100644 (file)
@@ -764,6 +764,9 @@ typing
   :func:`issubclass`, but warnings were not previously emitted if it was merely
   imported or accessed from the :mod:`!typing` module.
 
+* Deprecated :func:`!typing.no_type_check_decorator` has been removed.
+  (Contributed by Nikita Sobolev in :gh:`133601`.)
+
 
 unicodedata
 -----------
index db0501d70e3442a00f675a8d9fef7b4f20e24434..4076004bc13c85f42e3366516e925d8ae36a9835 100644 (file)
@@ -33,7 +33,7 @@ from typing import override
 from typing import is_typeddict, is_protocol
 from typing import reveal_type
 from typing import dataclass_transform
-from typing import no_type_check, no_type_check_decorator
+from typing import no_type_check
 from typing import Type
 from typing import NamedTuple, NotRequired, Required, ReadOnly, TypedDict, NoExtraItems
 from typing import IO, TextIO, BinaryIO
@@ -6376,35 +6376,6 @@ class NoTypeCheckTests(BaseTestCase):
         for clazz in [C, D, E, F]:
             self.assertEqual(get_type_hints(clazz), expected_result)
 
-    def test_meta_no_type_check(self):
-        depr_msg = (
-            "'typing.no_type_check_decorator' is deprecated "
-            "and slated for removal in Python 3.15"
-        )
-        with self.assertWarnsRegex(DeprecationWarning, depr_msg):
-            @no_type_check_decorator
-            def magic_decorator(func):
-                return func
-
-        self.assertEqual(magic_decorator.__name__, 'magic_decorator')
-
-        @magic_decorator
-        def foo(a: 'whatevers') -> {}:
-            pass
-
-        @magic_decorator
-        class C:
-            def foo(a: 'whatevers') -> {}:
-                pass
-
-        self.assertEqual(foo.__name__, 'foo')
-        th = get_type_hints(foo)
-        self.assertEqual(th, {})
-        cth = get_type_hints(C.foo)
-        self.assertEqual(cth, {})
-        ith = get_type_hints(C().foo)
-        self.assertEqual(ith, {})
-
 
 class InternalsTests(BaseTestCase):
     def test_collect_parameters(self):
index 25234d2d707dd2dfaaa1d325a17d1fe65faded85..eb0519986a895239ad463a176d97008423346cdf 100644 (file)
@@ -139,7 +139,6 @@ __all__ = [
     'Never',
     'NewType',
     'no_type_check',
-    'no_type_check_decorator',
     'NoDefault',
     'NoExtraItems',
     'NoReturn',
@@ -2623,23 +2622,6 @@ def no_type_check(arg):
     return arg
 
 
-def no_type_check_decorator(decorator):
-    """Decorator to give another decorator the @no_type_check effect.
-
-    This wraps the decorator with something that wraps the decorated
-    function in @no_type_check.
-    """
-    import warnings
-    warnings._deprecated("typing.no_type_check_decorator", remove=(3, 15))
-    @functools.wraps(decorator)
-    def wrapped_decorator(*args, **kwds):
-        func = decorator(*args, **kwds)
-        func = no_type_check(func)
-        return func
-
-    return wrapped_decorator
-
-
 def _overload_dummy(*args, **kwds):
     """Helper for @overload to raise when called."""
     raise NotImplementedError(
index a5f0161e8f591e263beb47b64c8fa487dc87fcd9..1391d6705757465336edcc268ffa3f734318dc7b 100644 (file)
@@ -3426,7 +3426,7 @@ This bug was introduced in Python 3.12.0 beta 1.
 .. nonce: hSlB17
 .. section: Library
 
-Deprecate :func:`typing.no_type_check_decorator`. No major type checker ever
+Deprecate :func:`!typing.no_type_check_decorator`. No major type checker ever
 added support for this decorator. Patch by Alex Waygood.
 
 ..
diff --git a/Misc/NEWS.d/next/Library/2025-05-07-22-09-28.gh-issue-133601.9kUL3P.rst b/Misc/NEWS.d/next/Library/2025-05-07-22-09-28.gh-issue-133601.9kUL3P.rst
new file mode 100644 (file)
index 0000000..62f40ae
--- /dev/null
@@ -0,0 +1 @@
+Remove deprecated :func:`!typing.no_type_check_decorator`.