From 2293e1bd4adb3c915e4411167f91b23550bfcbe4 Mon Sep 17 00:00:00 2001 From: Eduard Braun Date: Sun, 6 Dec 2015 22:53:03 +0100 Subject: [PATCH] Fix regex for list of points splitting: Expect at least one whitespace character or comma between coords. The previous regex would have allowed zero length matches and therefore could have split the string after every character - luckily this was not (yet) correctly implemented in Python. Since Python 3.5 a warning is raised informing of this problem. Future versions will correctly split also at zero length matches. See also note on https://docs.python.org/3/library/re.html#re.split --- scour/scour.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scour/scour.py b/scour/scour.py index fdfc0c7..a274a60 100644 --- a/scour/scour.py +++ b/scour/scour.py @@ -2123,7 +2123,7 @@ def parseListOfPoints(s): # coordinate-pair = coordinate comma-or-wsp coordinate # coordinate = sign? integer # comma-wsp: (wsp+ comma? wsp*) | (comma wsp*) - ws_nums = re.split(r"\s*,?\s*", s.strip()) + ws_nums = re.split(r"\s*[\s,]\s*", s.strip()) nums = [] # also, if 100-100 is found, split it into two also