Skip to content

Commit 7ce7af6

Browse files
committed
remove typing.no_type_check_decorator
1 parent 30b1d8f commit 7ce7af6

File tree

8 files changed

+12
-65
lines changed

8 files changed

+12
-65
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ Pending removal in Python 3.15
8585
has been deprecated since Python 3.13.
8686
Use the class-based syntax or the functional syntax instead.
8787

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

Doc/library/typing.rst

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3257,16 +3257,6 @@ Functions and decorators
32573257

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

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

32713261
.. decorator:: override
32723262

@@ -4081,7 +4071,7 @@ convenience. This is subject to change, and not all deprecations are listed.
40814071
- 3.12
40824072
- Undecided
40834073
- :pep:`695`
4084-
* - :func:`@typing.no_type_check_decorator <no_type_check_decorator>`
4074+
* - :func:`!@typing.no_type_check_decorator <no_type_check_decorator>`
40854075
- 3.13
40864076
- 3.15
40874077
- :gh:`106309`

Doc/whatsnew/3.13.rst

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

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

Doc/whatsnew/3.15.rst

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -118,10 +118,12 @@ Deprecated
118118
Removed
119119
=======
120120

121-
module_name
122-
-----------
121+
typing
122+
------
123123

124-
* TODO
124+
* Remove deprecated decorator :func:`!typing.no_type_check_decorator`
125+
as it has yet to be supported by any major type checker.
126+
(Contributed by Bénédikt Tran in :gh:`133818`.)
125127

126128

127129
Porting to Python 3.15

Lib/test/test_typing.py

Lines changed: 1 addition & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
from typing import is_typeddict, is_protocol
3333
from typing import reveal_type
3434
from typing import dataclass_transform
35-
from typing import no_type_check, no_type_check_decorator
35+
from typing import no_type_check
3636
from typing import Type
3737
from typing import NamedTuple, NotRequired, Required, ReadOnly, TypedDict
3838
from typing import IO, TextIO, BinaryIO
@@ -6273,35 +6273,6 @@ class F:
62736273
for clazz in [C, D, E, F]:
62746274
self.assertEqual(get_type_hints(clazz), expected_result)
62756275

6276-
def test_meta_no_type_check(self):
6277-
depr_msg = (
6278-
"'typing.no_type_check_decorator' is deprecated "
6279-
"and slated for removal in Python 3.15"
6280-
)
6281-
with self.assertWarnsRegex(DeprecationWarning, depr_msg):
6282-
@no_type_check_decorator
6283-
def magic_decorator(func):
6284-
return func
6285-
6286-
self.assertEqual(magic_decorator.__name__, 'magic_decorator')
6287-
6288-
@magic_decorator
6289-
def foo(a: 'whatevers') -> {}:
6290-
pass
6291-
6292-
@magic_decorator
6293-
class C:
6294-
def foo(a: 'whatevers') -> {}:
6295-
pass
6296-
6297-
self.assertEqual(foo.__name__, 'foo')
6298-
th = get_type_hints(foo)
6299-
self.assertEqual(th, {})
6300-
cth = get_type_hints(C.foo)
6301-
self.assertEqual(cth, {})
6302-
ith = get_type_hints(C().foo)
6303-
self.assertEqual(ith, {})
6304-
63056276

63066277
class InternalsTests(BaseTestCase):
63076278
def test_deprecation_for_no_type_params_passed_to__evaluate(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
'NoReturn',
145144
'NotRequired',
@@ -2551,23 +2550,6 @@ def no_type_check(arg):
25512550
return arg
25522551

25532552

2554-
def no_type_check_decorator(decorator):
2555-
"""Decorator to give another decorator the @no_type_check effect.
2556-
2557-
This wraps the decorator with something that wraps the decorated
2558-
function in @no_type_check.
2559-
"""
2560-
import warnings
2561-
warnings._deprecated("typing.no_type_check_decorator", remove=(3, 15))
2562-
@functools.wraps(decorator)
2563-
def wrapped_decorator(*args, **kwds):
2564-
func = decorator(*args, **kwds)
2565-
func = no_type_check(func)
2566-
return func
2567-
2568-
return wrapped_decorator
2569-
2570-
25712553
def _overload_dummy(*args, **kwds):
25722554
"""Helper for @overload to raise when called."""
25732555
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: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Remove deprecated decorator :func:`!typing.no_type_check_decorator`. Patch
2+
by Bénédikt Tran.

0 commit comments

Comments
 (0)