]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Issue #25287: Don't add crypt.METHOD_CRYPT to crypt.methods if it's not
authorVictor Stinner <victor.stinner@gmail.com>
Fri, 2 Oct 2015 21:00:39 +0000 (23:00 +0200)
committerVictor Stinner <victor.stinner@gmail.com>
Fri, 2 Oct 2015 21:00:39 +0000 (23:00 +0200)
supported. Check if it is supported, it may not be supported on OpenBSD for
example.

Doc/library/crypt.rst
Lib/crypt.py
Misc/NEWS

index b4c90cd59232fd67eb0d3378903fa541270b1bc5..04ffdb289b683ba19d052f0f0c907463806c19d7 100644 (file)
@@ -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
index 49ab96e1400bebe8dbdd62ce15d6911809a247a1..fbc5f4cc355ce6fa2bc2b959a2b5b138811d9888 100644 (file)
@@ -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
index b43073f288a1fa274d3f64cbf0de9d28b7183f6e..8aad689cfdaefc4a931d8687126d5e274787daf5 100644 (file)
--- 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.