This commit is contained in:
2025-01-26 19:24:23 -08:00
parent 32cd60e92b
commit d1dde0dbc6
4155 changed files with 29170 additions and 216373 deletions

View File

@@ -26,7 +26,7 @@ __all__ = [
'hasexternals', 'hasinitvalue', 'hasnote', 'hasresultnote',
'isallocatable', 'isarray', 'isarrayofstrings',
'ischaracter', 'ischaracterarray', 'ischaracter_or_characterarray',
'iscomplex',
'iscomplex', 'iscstyledirective',
'iscomplexarray', 'iscomplexfunction', 'iscomplexfunction_warn',
'isdouble', 'isdummyroutine', 'isexternal', 'isfunction',
'isfunction_wrap', 'isint1', 'isint1array', 'isinteger', 'isintent_aux',
@@ -423,6 +423,11 @@ def isrequired(var):
return not isoptional(var) and isintent_nothide(var)
def iscstyledirective(f2py_line):
directives = {"callstatement", "callprotoargument", "pymethoddef"}
return any(directive in f2py_line.lower() for directive in directives)
def isintent_in(var):
if 'intent' not in var:
return 1

View File

@@ -510,11 +510,9 @@ def readfortrancode(ffile, dowithline=show, istop=1):
origfinalline = ''
else:
if localdolowercase:
# lines with intent() should be lowered otherwise
# TestString::test_char fails due to mixed case
# f2py directives without intent() should be left untouched
# gh-2547, gh-27697, gh-26681
finalline = ll.lower() if "intent" in ll.lower() or not is_f2py_directive else ll
# only skip lowering for C style constructs
# gh-2547, gh-27697, gh-26681, gh-28014
finalline = ll.lower() if not (is_f2py_directive and iscstyledirective(ll)) else ll
else:
finalline = ll
origfinalline = ll

View File

@@ -245,6 +245,11 @@ PyMODINIT_FUNC PyInit_#modulename#(void) {
if (! PyErr_Occurred())
on_exit(f2py_report_on_exit,(void*)\"#modulename#\");
#endif
if (PyType_Ready(&PyFortran_Type) < 0) {
return NULL;
}
return m;
}
#ifdef __cplusplus

View File

@@ -122,6 +122,15 @@ class TestF90Contiuation(util.F2PyTest):
assert(res[0] == 8)
assert(res[1] == 15)
class TestLowerF2PYDirectives(util.F2PyTest):
# Check variables are cased correctly
sources = [util.getpath("tests", "src", "regression", "lower_f2py_fortran.f90")]
@pytest.mark.slow
def test_gh28014(self):
self.module.inquire_next(3)
assert True
@pytest.mark.slow
def test_gh26623():
# Including libraries with . should not generate an incorrect meson.build

View File

@@ -57,7 +57,6 @@ def check_language(lang, code_snippet=None):
return runmeson.returncode == 0
finally:
shutil.rmtree(tmpdir)
return False
fortran77_code = '''