Hello,

starting with python 3.6, the re.LOCALE flag can only be used with byte
patterns, and errors out if used with str. This patch removes the flag
in get_translated_hotkey().


References: https://bugs.launchpad.net/apparmor/+bug/1661766


I propose this patch for trunk, 2.10 and 2.9.


[ 01-re-locale.diff ]

=== modified file 'utils/apparmor/ui.py'
--- utils/apparmor/ui.py        2016-10-03 19:01:29 +0000
+++ utils/apparmor/ui.py        2017-02-16 21:29:22 +0000
@@ -64,8 +64,8 @@
     msg = 'PromptUser: ' + _('Invalid hotkey for')
 
     # Originally (\S) was used but with translations it would not work :(
-    if re.search('\((\S+)\)', translated, re.LOCALE):
-        return re.search('\((\S+)\)', translated, re.LOCALE).groups()[0]
+    if re.search('\((\S+)\)', translated):                                     
                                                                                
                                                                                
                               
+        return re.search('\((\S+)\)', translated).groups()[0]                  
                                                                                
                                                                                
                               
     else:                                                                      
                                                                                
                                                                                
                               
         if cmsg:                                                               
                                                                                
                                                                                
                               
             raise AppArmorException(cmsg)                                      
                                                                                
                                                                                
                               
                                                                                
                                                                                
                                                                                
                               
                                                                                
                                                                                
                                                                                
                               


Regards,

Christian Boltz
-- 
>Weil es sehr weit verbreitet ist, eingespielt und "überall drauf".
Die weite Verbreitung ist allenfalls geeignet, die kaputte Syntax
auszugleichen, ein Erfordernis also, kein Pluspunkt.
[> Ratti und Thorsten Haude in suse-linux zur Frage "Warum procmail?"]

Attachment: signature.asc
Description: This is a digitally signed message part.

-- 
AppArmor mailing list
AppArmor@lists.ubuntu.com
Modify settings or unsubscribe at: 
https://lists.ubuntu.com/mailman/listinfo/apparmor

Reply via email to