From 014fbfa86b3373ebdb1017fa9d94eac7ffc866ce Mon Sep 17 00:00:00 2001 From: Rasmus Wriedt Larsen Date: Fri, 27 Nov 2020 14:55:23 +0100 Subject: [PATCH] Python: Add regex FP with + for flags Notice that there is no new results for line 54 I also added a test for the short-named version of a flag, just since I didn't see any of those already. That just works out of the box (due to points-to). --- python/ql/test/library-tests/regex/Mode.expected | 3 ++- python/ql/test/library-tests/regex/test.py | 6 +++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/python/ql/test/library-tests/regex/Mode.expected b/python/ql/test/library-tests/regex/Mode.expected index 6e7cf5f31c49..fcf317de57d2 100644 --- a/python/ql/test/library-tests/regex/Mode.expected +++ b/python/ql/test/library-tests/regex/Mode.expected @@ -7,4 +7,5 @@ | 50 | VERBOSE | | 51 | UNICODE | | 52 | UNICODE | -| 64 | MULTILINE | +| 56 | VERBOSE | +| 68 | MULTILINE | diff --git a/python/ql/test/library-tests/regex/test.py b/python/ql/test/library-tests/regex/test.py index b09d7785f8a2..65c70a516564 100644 --- a/python/ql/test/library-tests/regex/test.py +++ b/python/ql/test/library-tests/regex/test.py @@ -1,5 +1,5 @@ import re -# 0123456789ABCDEF +# 0123456789ABCDEF re.compile(r'012345678') re.compile(r'(\033|~{)') re.compile(r'\A[+-]?\d+') @@ -50,6 +50,10 @@ re.compile("", flags=re.VERBOSE|re.IGNORECASE) re.search("", None, re.UNICODE) x = re.search("", flags=re.UNICODE) +# using addition for flags was reported as FP in https://github.com/github/codeql/issues/4707 +re.compile("", re.VERBOSE+re.DOTALL) # TODO: Currently not recognized with Mode.ql +# re.X is an alias for re.VERBOSE +re.compile("", re.X) #empty choice re.compile(r'|x')