summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorAlex Waygood <Alex.Waygood@Gmail.com>2023-07-13 13:30:35 (GMT)
committerGitHub <noreply@github.com>2023-07-13 13:30:35 (GMT)
commit32718f908cc92c474fd968912368b8a4500bd055 (patch)
tree5268ef57fb4f0e6c849eb1c2a66cc551f3102a83 /Lib
parent4b4a5b70aa8d47b1e2a0582b741c31b786da762a (diff)
downloadcpython-32718f908cc92c474fd968912368b8a4500bd055.zip
cpython-32718f908cc92c474fd968912368b8a4500bd055.tar.gz
cpython-32718f908cc92c474fd968912368b8a4500bd055.tar.bz2
gh-106309: Deprecate typing.no_type_check_decorator (#106312)
Diffstat (limited to 'Lib')
-rw-r--r--Lib/test/test_typing.py12
-rw-r--r--Lib/typing.py2
2 files changed, 10 insertions, 4 deletions
diff --git a/Lib/test/test_typing.py b/Lib/test/test_typing.py
index 1df2192..0450a87 100644
--- a/Lib/test/test_typing.py
+++ b/Lib/test/test_typing.py
@@ -5794,10 +5794,14 @@ class ForwardRefTests(BaseTestCase):
get_type_hints(clazz)
def test_meta_no_type_check(self):
-
- @no_type_check_decorator
- def magic_decorator(func):
- return func
+ 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')
diff --git a/Lib/typing.py b/Lib/typing.py
index 9187b74..387b4c5 100644
--- a/Lib/typing.py
+++ b/Lib/typing.py
@@ -2395,6 +2395,8 @@ def no_type_check_decorator(decorator):
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)