From d48905e51e5a042d60ee73c5c87eeeb58cd6eb16 Mon Sep 17 00:00:00 2001 From: Brett Cannon Date: Sat, 9 Apr 2022 19:45:17 -0700 Subject: [PATCH 1/3] Deprecate crypt --- Lib/crypt.py | 4 ++++ Lib/test/test_crypt.py | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/Lib/crypt.py b/Lib/crypt.py index 33dbc46bb3e96be..46c3de8474bf1cb 100644 --- a/Lib/crypt.py +++ b/Lib/crypt.py @@ -12,10 +12,14 @@ import errno import string as _string +import warnings from random import SystemRandom as _SystemRandom from collections import namedtuple as _namedtuple +warnings._deprecated(__name__, remove=(3, 13)) + + _saltchars = _string.ascii_letters + _string.digits + './' _sr = _SystemRandom() diff --git a/Lib/test/test_crypt.py b/Lib/test/test_crypt.py index 877c575c5534ae7..b2a5ce6db091950 100644 --- a/Lib/test/test_crypt.py +++ b/Lib/test/test_crypt.py @@ -1,12 +1,12 @@ import sys import unittest -from test.support import check_sanitizer +from test.support import check_sanitizer, warnings_helper try: if check_sanitizer(address=True, memory=True): raise unittest.SkipTest("The crypt module SEGFAULTs on ASAN/MSAN builds") - import crypt + crypt = warnings_helper.import_deprecated("crypt") IMPORT_ERROR = None except ImportError as ex: if sys.platform != 'win32': From d1d930a69f6f5fd22f188a81273d7dfcd7f2b911 Mon Sep 17 00:00:00 2001 From: Brett Cannon Date: Mon, 11 Apr 2022 16:12:23 -0700 Subject: [PATCH 2/3] Add a What's New entry --- Doc/whatsnew/3.11.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/Doc/whatsnew/3.11.rst b/Doc/whatsnew/3.11.rst index cc358b4ffdb2acd..354e2112338db26 100644 --- a/Doc/whatsnew/3.11.rst +++ b/Doc/whatsnew/3.11.rst @@ -851,6 +851,7 @@ Deprecated * :mod:`cgi` * :mod:`cgitb` * :mod:`chunk` + * :mod:`crypt` (Contributed by Brett Cannon in :issue:`47061`.) From 3aa7c04819903c2edfdcc61bd986fb1af049dd9a Mon Sep 17 00:00:00 2001 From: Brett Cannon Date: Mon, 11 Apr 2022 16:13:32 -0700 Subject: [PATCH 3/3] Add a news entry --- .../next/Library/2022-04-11-16-13-26.gh-issue-91217.2rf8rc.rst | 1 + 1 file changed, 1 insertion(+) create mode 100644 Misc/NEWS.d/next/Library/2022-04-11-16-13-26.gh-issue-91217.2rf8rc.rst diff --git a/Misc/NEWS.d/next/Library/2022-04-11-16-13-26.gh-issue-91217.2rf8rc.rst b/Misc/NEWS.d/next/Library/2022-04-11-16-13-26.gh-issue-91217.2rf8rc.rst new file mode 100644 index 000000000000000..067783f85c28aa6 --- /dev/null +++ b/Misc/NEWS.d/next/Library/2022-04-11-16-13-26.gh-issue-91217.2rf8rc.rst @@ -0,0 +1 @@ +Deprecate the crypt module.