Skip to content

Commit 34efd69

Browse files
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.
1 parent 2aa769b commit 34efd69

File tree

1 file changed

+12
-9
lines changed

1 file changed

+12
-9
lines changed

numpy/linalg/lapack_lite/clapack_scrub.py

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -228,15 +228,18 @@ def OutOfHeader(line):
228228
return lines.getValue()
229229

230230
def removeSubroutinePrototypes(source):
231-
expression = re.compile(
232-
r'/\* Subroutine \*/^\s*(?:(?:inline|static)\s+){0,2}(?!else|typedef|return)\w+\s+\*?\s*(\w+)\s*\([^0]+\)\s*;?'
233-
)
234-
lines = LineQueue()
235-
for line in UStringIO(source):
236-
if not expression.match(line):
237-
lines.add(line)
238-
239-
return lines.getValue()
231+
# This function has never worked as advertised by its name:
232+
# - "/* Subroutine */" declarations may span multiple lines and
233+
# cannot be matched by a line by line approach.
234+
# - The caret in the initial regex would prevent any match, even
235+
# of single line "/* Subroutine */" declarations.
236+
#
237+
# While we could "fix" this function to do what the name implies
238+
# it should do, we have no hint of what it should really do.
239+
#
240+
# Therefore we keep the existing (non-)functionaity, documenting
241+
# this function as doing nothing at all.
242+
return source
240243

241244
def removeBuiltinFunctions(source):
242245
lines = LineQueue()

0 commit comments

Comments
 (0)