summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2015-10-02 21:00:39 (GMT)
committerVictor Stinner <victor.stinner@gmail.com>2015-10-02 21:00:39 (GMT)
commit6661d885a34b355200b8ee6bd559af0a5cfc9c8b (patch)
treec0f0f5a78f983875d4320d62ada74fee9ce62644
parent4b5d8018dfc32a6edc73339787ed4530749ea90c (diff)
downloadcpython-6661d885a34b355200b8ee6bd559af0a5cfc9c8b.zip
cpython-6661d885a34b355200b8ee6bd559af0a5cfc9c8b.tar.gz
cpython-6661d885a34b355200b8ee6bd559af0a5cfc9c8b.tar.bz2
Issue #25287: Don't add crypt.METHOD_CRYPT to crypt.methods if it's not
supported. Check if it is supported, it may not be supported on OpenBSD for example.
-rw-r--r--Doc/library/crypt.rst2
-rw-r--r--Lib/crypt.py3
-rw-r--r--Misc/NEWS4
3 files changed, 6 insertions, 3 deletions
diff --git a/Doc/library/crypt.rst b/Doc/library/crypt.rst
index b4c90cd..04ffdb2 100644
--- a/Doc/library/crypt.rst
+++ b/Doc/library/crypt.rst
@@ -64,7 +64,7 @@ Module Attributes
A list of available password hashing algorithms, as
``crypt.METHOD_*`` objects. This list is sorted from strongest to
- weakest, and is guaranteed to have at least ``crypt.METHOD_CRYPT``.
+ weakest.
Module Functions
diff --git a/Lib/crypt.py b/Lib/crypt.py
index 49ab96e..fbc5f4c 100644
--- a/Lib/crypt.py
+++ b/Lib/crypt.py
@@ -54,9 +54,8 @@ METHOD_SHA256 = _Method('SHA256', '5', 16, 63)
METHOD_SHA512 = _Method('SHA512', '6', 16, 106)
methods = []
-for _method in (METHOD_SHA512, METHOD_SHA256, METHOD_MD5):
+for _method in (METHOD_SHA512, METHOD_SHA256, METHOD_MD5, METHOD_CRYPT):
_result = crypt('', _method)
if _result and len(_result) == _method.total_size:
methods.append(_method)
-methods.append(METHOD_CRYPT)
del _result, _method
diff --git a/Misc/NEWS b/Misc/NEWS
index b43073f..8aad689 100644
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -40,6 +40,10 @@ Core and Builtins
Library
-------
+- Issue #25287: Don't add crypt.METHOD_CRYPT to crypt.methods if it's not
+ supported. Check if it is supported, it may not be supported on OpenBSD for
+ example.
+
- Issue #23600: Default implementation of tzinfo.fromutc() was returning
wrong results in some cases.