Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gh-91217: deprecate nntplib #91543

Merged
merged 3 commits into from
Apr 15, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Doc/whatsnew/3.11.rst
Original file line number Diff line number Diff line change
Expand Up @@ -858,6 +858,7 @@ Deprecated
* :mod:`crypt`
* :mod:`imghdr`
* :mod:`msilib`
* :mod:`nntplib`

(Contributed by Brett Cannon in :issue:`47061`.)

Expand Down
3 changes: 3 additions & 0 deletions Lib/nntplib.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@
import collections
import datetime
import sys
import warnings

try:
import ssl
Expand All @@ -85,6 +86,8 @@
"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
Expand Down
4 changes: 2 additions & 2 deletions Lib/test/support/socket_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import sys

from .. import support

from . import warnings_helper

HOST = "localhost"
HOSTv4 = "127.0.0.1"
Expand Down Expand Up @@ -190,7 +190,7 @@ def get_socket_conn_refused_errs():
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
Expand Down
4 changes: 2 additions & 2 deletions Lib/test/test_nntplib.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@
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:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Deprecate nntplib.