diff --git a/Doc/whatsnew/3.11.rst b/Doc/whatsnew/3.11.rst index 8f0d3c7c709..b812658d5e9 100644 --- a/Doc/whatsnew/3.11.rst +++ b/Doc/whatsnew/3.11.rst @@ -1069,6 +1069,7 @@ Deprecated * :mod:`sndhdr` * :mod:`spwd` * :mod:`sunau` + * :mod:`telnetlib` (Contributed by Brett Cannon in :issue:`47061`.) diff --git a/Lib/telnetlib.py b/Lib/telnetlib.py index ae88ea59474..62d63612985 100644 --- a/Lib/telnetlib.py +++ b/Lib/telnetlib.py @@ -37,6 +37,9 @@ import socket import selectors from time import monotonic as _time +import warnings + +warnings._deprecated(__name__, remove=(3, 13)) __all__ = ["Telnet"] diff --git a/Lib/test/test_telnetlib.py b/Lib/test/test_telnetlib.py index b50df1459d1..a9cade2ee46 100644 --- a/Lib/test/test_telnetlib.py +++ b/Lib/test/test_telnetlib.py @@ -1,15 +1,16 @@ import socket import selectors -import telnetlib import threading import contextlib from test import support -from test.support import socket_helper +from test.support import socket_helper, warnings_helper import unittest support.requires_working_socket(module=True) +telnetlib = warnings_helper.import_deprecated('telnetlib') + HOST = socket_helper.HOST def server(evt, serv): diff --git a/Misc/NEWS.d/next/Library/2022-04-17-12-41-52.gh-issue-91217.3wnHSX.rst b/Misc/NEWS.d/next/Library/2022-04-17-12-41-52.gh-issue-91217.3wnHSX.rst new file mode 100644 index 00000000000..6c4acc79243 --- /dev/null +++ b/Misc/NEWS.d/next/Library/2022-04-17-12-41-52.gh-issue-91217.3wnHSX.rst @@ -0,0 +1 @@ +Deprecate the telnetlib module.