]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-91217: deprecate nntplib (GH-91543)
authorBrett Cannon <brett@python.org>
Fri, 15 Apr 2022 19:32:56 +0000 (12:32 -0700)
committerGitHub <noreply@github.com>
Fri, 15 Apr 2022 19:32:56 +0000 (12:32 -0700)
Doc/whatsnew/3.11.rst
Lib/nntplib.py
Lib/test/support/socket_helper.py
Lib/test/test_nntplib.py
Misc/NEWS.d/next/Library/2022-04-12-20-19-10.gh-issue-91217.acd4h9.rst [new file with mode: 0644]

index ca76efc963719a5d070decdec8678e1a9431535c..b5b2a7648c55ea51646e0ef872b54fd70404837d 100644 (file)
@@ -875,6 +875,7 @@ Deprecated
   * :mod:`crypt`
   * :mod:`imghdr`
   * :mod:`msilib`
+  * :mod:`nntplib`
 
   (Contributed by Brett Cannon in :issue:`47061`.)
 
index f6e746e7c95c5bfdcaebff155a140de34d71fed1..dddea059982be13e49cad0ce876bd0fcb0c05886 100644 (file)
@@ -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
index 0ee7a5d69a1b30b7f4ed40496f9d232d8fe3c637..754af181ec922ea2c0f620b28428d331237c2b5f 100644 (file)
@@ -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
index 4f0592188f84438cb863062dd12b1c2bf6622aa4..9812c055193517d4c86edb558cc608784ad3da3e 100644 (file)
@@ -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:
diff --git a/Misc/NEWS.d/next/Library/2022-04-12-20-19-10.gh-issue-91217.acd4h9.rst b/Misc/NEWS.d/next/Library/2022-04-12-20-19-10.gh-issue-91217.acd4h9.rst
new file mode 100644 (file)
index 0000000..4a74b9d
--- /dev/null
@@ -0,0 +1 @@
+Deprecate nntplib.