mirror of
https://github.com/openvswitch/ovs
synced 2025-10-25 15:07:05 +00:00
python: Fix invalid escape sequences.
It appears that Python silently treats invalid escape sequences in strings as literals, e.g. "\." is the same as "\\.". Newer versions of checkpatch complain, and it does seem reasonable to me to fix these. Acked-by: Numan Siddique <nusiddiq@redhat.com> Tested-by: Numan Siddique <nusiddiq@redhat.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
This commit is contained in:
@@ -177,7 +177,7 @@ class Parser(object):
|
||||
return False
|
||||
|
||||
__number_re = re.compile("(-)?(0|[1-9][0-9]*)"
|
||||
"(?:\.([0-9]+))?(?:[eE]([-+]?[0-9]+))?$")
|
||||
r"(?:\.([0-9]+))?(?:[eE]([-+]?[0-9]+))?$")
|
||||
|
||||
def __lex_finish_number(self):
|
||||
s = self.buffer
|
||||
@@ -234,7 +234,7 @@ class Parser(object):
|
||||
self.__error("leading zeros not allowed")
|
||||
elif re.match("-([^0-9]|$)", s):
|
||||
self.__error("'-' must be followed by digit")
|
||||
elif re.match("-?(0|[1-9][0-9]*)\.([^0-9]|$)", s):
|
||||
elif re.match(r"-?(0|[1-9][0-9]*)\.([^0-9]|$)", s):
|
||||
self.__error("decimal point must be followed by digit")
|
||||
elif re.search("e[-+]?([^0-9]|$)", s):
|
||||
self.__error("exponent must contain at least one digit")
|
||||
|
||||
Reference in New Issue
Block a user