gh-104773: PEP 594: Remove the nntplib module (#104894)

* socket_helper.transient_internet() no longer imports nntplib to
  catch nntplib.NNTPTemporaryError.
* ssltests.py no longer runs test_nntplib.
* "make quicktest" no longer runs test_nntplib.
* WASM: remove nntplib from OMIT_NETWORKING_FILES.
* Remove mentions to nntplib in the email documentation.
This commit is contained in:
Victor Stinner 2023-05-24 23:15:43 +02:00 committed by GitHub
parent 684e99d01d
commit ded5f1f287
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
26 changed files with 33 additions and 3364 deletions

View file

@ -7,7 +7,6 @@ import tempfile
import unittest
from .. import support
from . import warnings_helper
HOST = "localhost"
HOSTv4 = "127.0.0.1"
@ -195,7 +194,6 @@ _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."""
nntplib = warnings_helper.import_deprecated("nntplib")
import urllib.error
if timeout is _NOT_SET:
timeout = support.INTERNET_TIMEOUT
@ -248,10 +246,6 @@ def transient_internet(resource_name, *, timeout=_NOT_SET, errnos=()):
if timeout is not None:
socket.setdefaulttimeout(timeout)
yield
except nntplib.NNTPTemporaryError as err:
if support.verbose:
sys.stderr.write(denied.args[0] + "\n")
raise denied from err
except OSError as err:
# urllib can wrap original socket errors multiple times (!), we must
# unwrap to get at the original error.