File: 0001-Fix-regex-SyntaxWarning.patch

package info (click to toggle)
revelation 0.5.6-1
  • links: PTS
  • area: main
  • in suites: sid
  • size: 2,076 kB
  • sloc: python: 5,633; xml: 262; makefile: 12
file content (50 lines) | stat: -rw-r--r-- 2,147 bytes parent folder | download | duplicates (2)
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
46
47
48
49
50
Description: fix regexp SyntaxWarning with recent Python versions
 Even during package installation the following lines were noted:
   /usr/lib/python3/dist-packages/revelation/datahandler/pwsafe.py:338:
   SyntaxWarning: invalid escape sequence '\s'
   /usr/lib/python3/dist-packages/revelation/datahandler/rvl.py:147:
   SyntaxWarning: invalid escape sequence '\s'
 Double escape the regexp patterns.
Author: Laszlo Boszormenyi (GCS) <gcs@debian.org>
Bug-Debian: https://bugs.debian.org/1087048
Forwarded: no
Last-Update: 2025-10-25

---

--- revelation-0.5.5.orig/src/lib/datahandler/pwsafe.py
+++ revelation-0.5.5/src/lib/datahandler/pwsafe.py
@@ -335,7 +335,7 @@ def normalize_field(field):
     enc = locale.getpreferredencoding()
 
     field = field.replace(b"\x00", b"")
-    field = re.sub(b"\s+", b" ", field)
+    field = re.sub(b"\\s+", b" ", field)
     field = field.strip()
     field = field.decode(enc, "replace")
 
--- revelation-0.5.5.orig/src/lib/datahandler/rvl.py
+++ revelation-0.5.5/src/lib/datahandler/rvl.py
@@ -145,14 +145,14 @@ class RevelationXML(base.DataHandler):
             input = input.encode()
 
         match = re.match(b"""
-            \s*                 # whitespace at beginning
-            <\?xml(?:.*)\?>     # xml header
-            \s*                 # whitespace after xml header
-            <revelationdata     # open revelationdata tag
-            [^>]+               # any non-closing character
-            dataversion="(\d+)" # dataversion
-            [^>]*               # any non-closing character
-            >                   # close revelationdata tag
+            \\s*                 # whitespace at beginning
+            <\\?xml(?:.*)\\?>    # xml header
+            \\s*                 # whitespace after xml header
+            <revelationdata      # open revelationdata tag
+            [^>]+                # any non-closing character
+            dataversion="(\\d+)" # dataversion
+            [^>]*                # any non-closing character
+            >                    # close revelationdata tag
         """, input, re.VERBOSE)
 
         if match is None: