summaryrefslogtreecommitdiff
path: root/numpy
diff options
context:
space:
mode:
authorDimitri Papadopoulos <3234522+DimitriPapadopoulos@users.noreply.github.com>2021-09-21 11:54:12 +0200
committerDimitri Papadopoulos <3234522+DimitriPapadopoulos@users.noreply.github.com>2021-09-22 00:32:39 +0200
commit34efd6957e3ca3d9981042b0db21addf4f4884ef (patch)
tree454f362f19d6e3a29943b4e3977a33280e5388cd /numpy
parent2aa769b287c750658a20127047e06cc94fbd4618 (diff)
downloadnumpy-34efd6957e3ca3d9981042b0db21addf4f4884ef.tar.gz
MAINT: Fix LGTM.com error
Unmatchable caret in regular expression This regular expression includes an unmatchable caret at offset 18. Indeed this regex couldn't possibly match anything. Not only does the regex look obsolete, attempting to match "inline" or "static" specifiers that I cannot find in the sources produced by 'f2c', but the very logic of function removeSubroutinePrototypes() makes it impossible to handle '/* Subroutine */' declarations that span multiple lines. All in all, function removeSubroutinePrototypes() does nothing at all. We choose not to change that, because it works and we have no real hint what it should do and why. We just document that.
Diffstat (limited to 'numpy')
-rw-r--r--numpy/linalg/lapack_lite/clapack_scrub.py21
1 files changed, 12 insertions, 9 deletions
diff --git a/numpy/linalg/lapack_lite/clapack_scrub.py b/numpy/linalg/lapack_lite/clapack_scrub.py
index e6f2d09f4..fffd70910 100644
--- a/numpy/linalg/lapack_lite/clapack_scrub.py
+++ b/numpy/linalg/lapack_lite/clapack_scrub.py
@@ -228,15 +228,18 @@ def removeHeader(source):
return lines.getValue()
def removeSubroutinePrototypes(source):
- expression = re.compile(
- r'/\* Subroutine \*/^\s*(?:(?:inline|static)\s+){0,2}(?!else|typedef|return)\w+\s+\*?\s*(\w+)\s*\([^0]+\)\s*;?'
- )
- lines = LineQueue()
- for line in UStringIO(source):
- if not expression.match(line):
- lines.add(line)
-
- return lines.getValue()
+ # This function has never worked as advertised by its name:
+ # - "/* Subroutine */" declarations may span multiple lines and
+ # cannot be matched by a line by line approach.
+ # - The caret in the initial regex would prevent any match, even
+ # of single line "/* Subroutine */" declarations.
+ #
+ # While we could "fix" this function to do what the name implies
+ # it should do, we have no hint of what it should really do.
+ #
+ # Therefore we keep the existing (non-)functionaity, documenting
+ # this function as doing nothing at all.
+ return source
def removeBuiltinFunctions(source):
lines = LineQueue()