Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit a19acf1

Browse filesBrowse files
HaoZekecharris
authored andcommitted
BUG: Fix casing for f2py directives
1 parent feae11d commit a19acf1
Copy full SHA for a19acf1

File tree

Expand file treeCollapse file tree

2 files changed

+9
-6
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+9
-6
lines changed

‎numpy/f2py/auxfuncs.py

Copy file name to clipboardExpand all lines: numpy/f2py/auxfuncs.py
+6-1Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
'hasexternals', 'hasinitvalue', 'hasnote', 'hasresultnote',
2727
'isallocatable', 'isarray', 'isarrayofstrings',
2828
'ischaracter', 'ischaracterarray', 'ischaracter_or_characterarray',
29-
'iscomplex',
29+
'iscomplex', 'iscstyledirective',
3030
'iscomplexarray', 'iscomplexfunction', 'iscomplexfunction_warn',
3131
'isdouble', 'isdummyroutine', 'isexternal', 'isfunction',
3232
'isfunction_wrap', 'isint1', 'isint1array', 'isinteger', 'isintent_aux',
@@ -423,6 +423,11 @@ def isrequired(var):
423423
return not isoptional(var) and isintent_nothide(var)
424424

425425

426+
def iscstyledirective(f2py_line):
427+
directives = {"callstatement", "callprotoargument", "pymethoddef"}
428+
return any(directive in f2py_line.lower() for directive in directives)
429+
430+
426431
def isintent_in(var):
427432
if 'intent' not in var:
428433
return 1

‎numpy/f2py/crackfortran.py

Copy file name to clipboardExpand all lines: numpy/f2py/crackfortran.py
+3-5Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -510,11 +510,9 @@ def readfortrancode(ffile, dowithline=show, istop=1):
510510
origfinalline = ''
511511
else:
512512
if localdolowercase:
513-
# lines with intent() should be lowered otherwise
514-
# TestString::test_char fails due to mixed case
515-
# f2py directives without intent() should be left untouched
516-
# gh-2547, gh-27697, gh-26681
517-
finalline = ll.lower() if "intent" in ll.lower() or not is_f2py_directive else ll
513+
# only skip lowering for C style constructs
514+
# gh-2547, gh-27697, gh-26681, gh-28014
515+
finalline = ll.lower() if not (is_f2py_directive and iscstyledirective(ll)) else ll
518516
else:
519517
finalline = ll
520518
origfinalline = ll

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.