Skip to content

Commit c95c2f0

Browse files
committed
BUG: Handle more edge cases with --lower
1 parent 3cdfd82 commit c95c2f0

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

numpy/f2py/crackfortran.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -481,7 +481,7 @@ def readfortrancode(ffile, dowithline=show, istop=1):
481481
else:
482482
# clean up line beginning from possible digits.
483483
l = ' ' + l[5:]
484-
# f2py directives are already by this point
484+
# f2py directives are already stripped by this point
485485
if localdolowercase:
486486
finalline = ll.lower()
487487
else:
@@ -510,8 +510,12 @@ def readfortrancode(ffile, dowithline=show, istop=1):
510510
finalline = ''
511511
origfinalline = ''
512512
else:
513-
if localdolowercase and not is_f2py_directive:
514-
finalline = ll.lower()
513+
if localdolowercase:
514+
# lines with intent() should be lowered otherwise
515+
# TestString::test_char fails due to mixed case
516+
# f2py directives without intent() should be left untouched
517+
# gh-2547, gh-27697, gh-26681
518+
finalline = ll.lower() if "intent" in ll.lower() or not is_f2py_directive else ll
515519
else:
516520
finalline = ll
517521
origfinalline = ll

0 commit comments

Comments
 (0)