summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBob Eldering <eldering@jive.eu>2018-03-08 17:16:48 +0100
committerBob Eldering <eldering@jive.eu>2018-03-08 17:23:15 +0100
commita9cdd90902ed9124dbd6cdd3464706cac513480b (patch)
tree53c875e461dc212aae42e21551b3adb7f75da25d
parente3fe42f0473d41f97db5a40e3ddd067391df57f0 (diff)
downloadpython-numpy-a9cdd90902ed9124dbd6cdd3464706cac513480b.tar.gz
python-numpy-a9cdd90902ed9124dbd6cdd3464706cac513480b.tar.bz2
python-numpy-a9cdd90902ed9124dbd6cdd3464706cac513480b.zip
BUG: fix for splitting a multiline or enhancement by ';' in numpy.f2py.
The variable line was assigned to before checking whether it contains a multiline or f2py enhancement pattern. In these cases the line should not be split by ';'. See pull request #10676.
-rwxr-xr-xnumpy/f2py/crackfortran.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/numpy/f2py/crackfortran.py b/numpy/f2py/crackfortran.py
index 38f3f2481..dc560f98e 100755
--- a/numpy/f2py/crackfortran.py
+++ b/numpy/f2py/crackfortran.py
@@ -652,12 +652,13 @@ def crackline(line, reset=0):
global filepositiontext, currentfilename, neededmodule, expectbegin
global skipblocksuntil, skipemptyends, previous_context, gotnextfile
- line, semicolon_line = split_by_unquoted(line, ";")
- if semicolon_line and not (f2pyenhancementspattern[0].match(line) or
+ _, has_semicolon = split_by_unquoted(line, ";")
+ if has_semicolon and not (f2pyenhancementspattern[0].match(line) or
multilinepattern[0].match(line)):
# XXX: non-zero reset values need testing
assert reset == 0, repr(reset)
# split line on unquoted semicolons
+ line, semicolon_line = split_by_unquoted(line, ";")
while semicolon_line:
crackline(line, reset)
line, semicolon_line = split_by_unquoted(semicolon_line[1:], ";")