File: legacycrypt.patch

package info (click to toggle)
python-passlib 1.7.4-6
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 3,920 kB
  • sloc: python: 23,094; makefile: 3
file content (45 lines) | stat: -rw-r--r-- 1,417 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
From: Colin Watson <cjwatson@debian.org>
Date: Sun, 2 Mar 2025 16:56:33 +0000
Subject: Accept legacycrypt as an alternative to crypt

`crypt` was removed in Python 3.13.

Bug-Debian: https://bugs.debian.org/1090282
Last-Update: 2025-03-02
---
 passlib/tests/utils.py    | 5 ++++-
 passlib/utils/__init__.py | 5 ++++-
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/passlib/tests/utils.py b/passlib/tests/utils.py
index 79a9f9f..550fad8 100644
--- a/passlib/tests/utils.py
+++ b/passlib/tests/utils.py
@@ -3404,7 +3404,10 @@ class OsCryptMixin(HandlerCase):
             return None
 
         # create a wrapper for fuzzy verified to use
-        from crypt import crypt
+        try:
+            from crypt import crypt
+        except ImportError:
+            from legacycrypt import crypt
         from passlib.utils import _safe_crypt_lock
         encoding = self.FuzzHashGenerator.password_encoding
 
diff --git a/passlib/utils/__init__.py b/passlib/utils/__init__.py
index 6147886..2643e77 100644
--- a/passlib/utils/__init__.py
+++ b/passlib/utils/__init__.py
@@ -851,7 +851,10 @@ def is_safe_crypt_input(value):
         return False
 
 try:
-    from crypt import crypt as _crypt
+    try:
+        from crypt import crypt as _crypt
+    except ImportError:
+        from legacycrypt import crypt as _crypt
 except ImportError: # pragma: no cover
     _crypt = None
     has_crypt = False