summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorBrett Cannon <brett@python.org>2022-04-15 19:32:56 (GMT)
committerGitHub <noreply@github.com>2022-04-15 19:32:56 (GMT)
commitc9e231de8551ab6d06c92dfa95033150e52d7f1f (patch)
treebac99035fe2731b0a76d26495e044e8d396ef373 /Lib
parentea2ae026078b328ddeab060940568a4d3bf1b417 (diff)
downloadcpython-c9e231de8551ab6d06c92dfa95033150e52d7f1f.zip
cpython-c9e231de8551ab6d06c92dfa95033150e52d7f1f.tar.gz
cpython-c9e231de8551ab6d06c92dfa95033150e52d7f1f.tar.bz2
gh-91217: deprecate nntplib (GH-91543)
Diffstat (limited to 'Lib')
-rw-r--r--Lib/nntplib.py3
-rw-r--r--Lib/test/support/socket_helper.py4
-rw-r--r--Lib/test/test_nntplib.py4
3 files changed, 7 insertions, 4 deletions
diff --git a/Lib/nntplib.py b/Lib/nntplib.py
index f6e746e..dddea05 100644
--- a/Lib/nntplib.py
+++ b/Lib/nntplib.py
@@ -68,6 +68,7 @@ import socket
import collections
import datetime
import sys
+import warnings
try:
import ssl
@@ -85,6 +86,8 @@ __all__ = ["NNTP",
"decode_header",
]
+warnings._deprecated(__name__, remove=(3, 13))
+
# maximal line length when calling readline(). This is to prevent
# reading arbitrary length lines. RFC 3977 limits NNTP line length to
# 512 characters, including CRLF. We have selected 2048 just to be on
diff --git a/Lib/test/support/socket_helper.py b/Lib/test/support/socket_helper.py
index 0ee7a5d..754af18 100644
--- a/Lib/test/support/socket_helper.py
+++ b/Lib/test/support/socket_helper.py
@@ -5,7 +5,7 @@ import unittest
import sys
from .. import support
-
+from . import warnings_helper
HOST = "localhost"
HOSTv4 = "127.0.0.1"
@@ -190,7 +190,7 @@ _NOT_SET = object()
def transient_internet(resource_name, *, timeout=_NOT_SET, errnos=()):
"""Return a context manager that raises ResourceDenied when various issues
with the internet connection manifest themselves as exceptions."""
- import nntplib
+ nntplib = warnings_helper.import_deprecated("nntplib")
import urllib.error
if timeout is _NOT_SET:
timeout = support.INTERNET_TIMEOUT
diff --git a/Lib/test/test_nntplib.py b/Lib/test/test_nntplib.py
index 4f05921..9812c05 100644
--- a/Lib/test/test_nntplib.py
+++ b/Lib/test/test_nntplib.py
@@ -5,13 +5,13 @@ import textwrap
import unittest
import functools
import contextlib
-import nntplib
import os.path
import re
import threading
from test import support
-from test.support import socket_helper
+from test.support import socket_helper, warnings_helper
+nntplib = warnings_helper.import_deprecated("nntplib")
from nntplib import NNTP, GroupInfo
from unittest.mock import patch
try: