mirror of
https://github.com/samba-team/samba.git
synced 2025-10-25 19:33:18 +03:00
python: use raw string for regex with escape
Python regards 'GPT\.INI$' as a string containing an invalid escape
sequence '\.', which is ignored (i.e. treated as the literal sequence
of those 2 characters), but only after Python has grumbled to itself,
and to you if you enabled DeprecationWarnings.
The proper thing to do here is use r-strings, like r'GPT\.INI$', which
tell Python that all backslashes are literal. Alternatively (as we do
once in this patch), the backslash can itself be escaped ('\\').
There are more problems of this nature in the build scripts.
Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Noel Power <npower@samba.org>
This commit is contained in:
committed by
Noel Power
parent
c247afbda0
commit
07fa6678e4
@@ -319,7 +319,7 @@ class GptTmplInfParser(GPParser):
|
||||
current_header_name = None
|
||||
|
||||
for line in inf_file.splitlines():
|
||||
match = re.match('\[(.*)\]', line)
|
||||
match = re.match(r'\[(.*)\]', line)
|
||||
if match:
|
||||
header_name = match.group(1)
|
||||
if header_name in self.sections:
|
||||
|
||||
Reference in New Issue
Block a user