[Python-checkins] gh-91217: deprecate crypt (GH-91459)
brettcannon
webhook-mailer at python.org
Mon Apr 11 20:02:27 EDT 2022
https://github.com/python/cpython/commit/f45aa8f304a12990c2ca687f2088f04b07906033
commit: f45aa8f304a12990c2ca687f2088f04b07906033
branch: main
author: Brett Cannon <brett at python.org>
committer: brettcannon <brett at python.org>
date: 2022-04-11T17:02:19-07:00
summary:
gh-91217: deprecate crypt (GH-91459)
files:
A Misc/NEWS.d/next/Library/2022-04-11-16-13-26.gh-issue-91217.2rf8rc.rst
M Doc/whatsnew/3.11.rst
M Lib/crypt.py
M Lib/test/test_crypt.py
diff --git a/Doc/whatsnew/3.11.rst b/Doc/whatsnew/3.11.rst
index cc358b4ffdb2a..354e2112338db 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`.)
diff --git a/Lib/crypt.py b/Lib/crypt.py
index 33dbc46bb3e96..46c3de8474bf1 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 877c575c5534a..b2a5ce6db0919 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':
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 0000000000000..067783f85c28a
--- /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.
More information about the Python-checkins
mailing list