MAINT: Update END statements parsing for recent Fortran standards.#18415
MAINT: Update END statements parsing for recent Fortran standards.#18415mattip merged 1 commit intonumpy:masterfrom
Conversation
|
It would be nice to add some tests that use the new keywords |
The corresponding statements have no influence on f2py output, they are just ignored. Even when misspelled they are ignored but with a "Mismatch of blocks encountered" warning. Technically, f2py does not implement Fortran parser and so it does not have to be exact in details that it never uses. In fact, in this particular case, there is nothing to test: with or without this PR f2py produces a correctly working code. So, adding the corresponding tests would just add maintenance burden to numpy, waste CI resources, and slow down f2py development, IMHO. Sometimes such tests would not be even possible when the Fortran compiler used for testing does not implement the features of the latest Fortran standard but f2py can be still used in wrapping such codes. |
|
I am confused. If "with or without this PR f2py produces correctly working code", then why do we need it? The original issue starts with "f2py break with functions/subroutines containing associate construct." So does it break or not? |
|
No, it does not break. The PR is needed for updating a piece of f2py to newer Fortran standards that did not exist at the time of creating f2py. The PR is maintenance PR, not a new-feature or a bug-fix PR. |
|
I guess this is to handle code like this (from here) So should the regex also allow an optional name fragment after |
|
Yes, the relevant regular expressions also allow optional names after numpy/numpy/f2py/crackfortran.py Line 579 in 46e984e As said before, those numpy/numpy/f2py/crackfortran.py Line 798 in 46e984e but they are relevant for processing other end statements correctly.
|
|
Thanks @pearu |
Closes #2763
While f2py is able to recover from parsing unknown end statements, this update avoids triggering the recovery process.
So, this PR does not deserve a separate test as the constructs in the
ifdefsdo not change the f2py wrapping outcome.