Skip to content

Commit e09837f

Browse files
authored
gh-133601: Remove deprecated typing.no_type_check_decorator (#133602)
1 parent a752f58 commit e09837f

File tree

8 files changed

+8
-66
lines changed

8 files changed

+8
-66
lines changed

Doc/deprecations/pending-removal-in-3.15.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ Pending removal in Python 3.15
9292
Use ``class TD(TypedDict): pass`` or ``TD = TypedDict("TD", {})``
9393
to create a TypedDict with zero field.
9494

95-
* The :func:`typing.no_type_check_decorator` decorator function
95+
* The :func:`!typing.no_type_check_decorator` decorator function
9696
has been deprecated since Python 3.13.
9797
After eight years in the :mod:`typing` module,
9898
it has yet to be supported by any major type checker.

Doc/library/typing.rst

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3258,17 +3258,6 @@ Functions and decorators
32583258

32593259
``@no_type_check`` mutates the decorated object in place.
32603260

3261-
.. decorator:: no_type_check_decorator
3262-
3263-
Decorator to give another decorator the :func:`no_type_check` effect.
3264-
3265-
This wraps the decorator with something that wraps the decorated
3266-
function in :func:`no_type_check`.
3267-
3268-
.. deprecated-removed:: 3.13 3.15
3269-
No type checker ever added support for ``@no_type_check_decorator``. It
3270-
is therefore deprecated, and will be removed in Python 3.15.
3271-
32723261
.. decorator:: override
32733262

32743263
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.
41144103
- 3.12
41154104
- Undecided
41164105
- :pep:`695`
4117-
* - :func:`@typing.no_type_check_decorator <no_type_check_decorator>`
4118-
- 3.13
4119-
- 3.15
4120-
- :gh:`106309`
41214106
* - :data:`typing.AnyStr`
41224107
- 3.13
41234108
- 3.18

Doc/whatsnew/3.13.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1993,7 +1993,7 @@ New Deprecations
19931993
use ``class TD(TypedDict): pass`` or ``TD = TypedDict("TD", {})``.
19941994
(Contributed by Alex Waygood in :gh:`105566` and :gh:`105570`.)
19951995

1996-
* Deprecate the :func:`typing.no_type_check_decorator` decorator function,
1996+
* Deprecate the :func:`!typing.no_type_check_decorator` decorator function,
19971997
to be removed in Python 3.15.
19981998
After eight years in the :mod:`typing` module,
19991999
it has yet to be supported by any major type checker.

Doc/whatsnew/3.15.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -764,6 +764,9 @@ typing
764764
:func:`issubclass`, but warnings were not previously emitted if it was merely
765765
imported or accessed from the :mod:`!typing` module.
766766

767+
* Deprecated :func:`!typing.no_type_check_decorator` has been removed.
768+
(Contributed by Nikita Sobolev in :gh:`133601`.)
769+
767770

768771
unicodedata
769772
-----------

Lib/test/test_typing.py

Lines changed: 1 addition & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
from typing import is_typeddict, is_protocol
3434
from typing import reveal_type
3535
from typing import dataclass_transform
36-
from typing import no_type_check, no_type_check_decorator
36+
from typing import no_type_check
3737
from typing import Type
3838
from typing import NamedTuple, NotRequired, Required, ReadOnly, TypedDict, NoExtraItems
3939
from typing import IO, TextIO, BinaryIO
@@ -6376,35 +6376,6 @@ class F:
63766376
for clazz in [C, D, E, F]:
63776377
self.assertEqual(get_type_hints(clazz), expected_result)
63786378

6379-
def test_meta_no_type_check(self):
6380-
depr_msg = (
6381-
"'typing.no_type_check_decorator' is deprecated "
6382-
"and slated for removal in Python 3.15"
6383-
)
6384-
with self.assertWarnsRegex(DeprecationWarning, depr_msg):
6385-
@no_type_check_decorator
6386-
def magic_decorator(func):
6387-
return func
6388-
6389-
self.assertEqual(magic_decorator.__name__, 'magic_decorator')
6390-
6391-
@magic_decorator
6392-
def foo(a: 'whatevers') -> {}:
6393-
pass
6394-
6395-
@magic_decorator
6396-
class C:
6397-
def foo(a: 'whatevers') -> {}:
6398-
pass
6399-
6400-
self.assertEqual(foo.__name__, 'foo')
6401-
th = get_type_hints(foo)
6402-
self.assertEqual(th, {})
6403-
cth = get_type_hints(C.foo)
6404-
self.assertEqual(cth, {})
6405-
ith = get_type_hints(C().foo)
6406-
self.assertEqual(ith, {})
6407-
64086379

64096380
class InternalsTests(BaseTestCase):
64106381
def test_collect_parameters(self):

Lib/typing.py

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,6 @@
139139
'Never',
140140
'NewType',
141141
'no_type_check',
142-
'no_type_check_decorator',
143142
'NoDefault',
144143
'NoExtraItems',
145144
'NoReturn',
@@ -2623,23 +2622,6 @@ def no_type_check(arg):
26232622
return arg
26242623

26252624

2626-
def no_type_check_decorator(decorator):
2627-
"""Decorator to give another decorator the @no_type_check effect.
2628-
2629-
This wraps the decorator with something that wraps the decorated
2630-
function in @no_type_check.
2631-
"""
2632-
import warnings
2633-
warnings._deprecated("typing.no_type_check_decorator", remove=(3, 15))
2634-
@functools.wraps(decorator)
2635-
def wrapped_decorator(*args, **kwds):
2636-
func = decorator(*args, **kwds)
2637-
func = no_type_check(func)
2638-
return func
2639-
2640-
return wrapped_decorator
2641-
2642-
26432625
def _overload_dummy(*args, **kwds):
26442626
"""Helper for @overload to raise when called."""
26452627
raise NotImplementedError(

Misc/NEWS.d/3.13.0a1.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3426,7 +3426,7 @@ This bug was introduced in Python 3.12.0 beta 1.
34263426
.. nonce: hSlB17
34273427
.. section: Library
34283428
3429-
Deprecate :func:`typing.no_type_check_decorator`. No major type checker ever
3429+
Deprecate :func:`!typing.no_type_check_decorator`. No major type checker ever
34303430
added support for this decorator. Patch by Alex Waygood.
34313431

34323432
..
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Remove deprecated :func:`!typing.no_type_check_decorator`.

0 commit comments

Comments
 (0)