BUG: Fixes #17797 f2py assumed shape and callbacks#17800
BUG: Fixes #17797 f2py assumed shape and callbacks#17800krystophny wants to merge 2 commits intonumpy:masterfrom krystophny:master
Conversation
numpy/f2py/func2subr.py
Outdated
There was a problem hiding this comment.
Assuming line is a str and not a list: the second condition is a subset of the first one, and so is redundant - was that deliberate?
There was a problem hiding this comment.
@eric-wieser thanks for the quick review! I have changed the condition to something more meaningful. Actually it should remove everything that looks like use something__user__stuff.
|
... just built scipy successfully with my modified numpy here, so seems not to break f2py also besides unit test here. |
|
@eric-wieser any news on the topic? Is there anything else I should change? In addition I'm also planning to add a small patch on how to treat |
numpy/f2py/func2subr.py
Outdated
There was a problem hiding this comment.
Is __user__ an existing f2py thing, or something new you're adding here?
There was a problem hiding this comment.
This is an f2py thing and also checked in other places as an exceptional case. (see https://github.com/numpy/numpy/blob/master/doc/source/f2py/python-usage.rst )
There was a problem hiding this comment.
... even more explicitly: This is the intended and documented behaviour of f2py that also occurs if you don't trigger the bug, i.e. don't define an assumed shape array in the same subroutine.
There was a problem hiding this comment.
@eric-wieser what are the further steps now? As far as I can tell the PR fixes the bug and introduces only minimal changes to reproduce documented behaviour.
|
I'll review this PR. Please don't merge yet. |
|
I confirm, this PR does not fix the underlying problem: when using an assumed shape array argument, the code must be f90, and wrapping the subroutine is required. So, f2py constructs a wrapper subroutine containing f90 code but the constructed code is compiled in f77 mode (notice the This PR works around the problem by skipping |
|
Superseeded by #18184 which includes the present fix regarding |
This is a small fix for #17797 that checks if a custom
__user__use statement was inserted for callback functionality in f2py. I figured thatfunc2subr.pywas the best place to do these changes, as the generation happens there, and the code is already quite intertwined. Going directly intocrackfortran.pyinstead would affect too many other things.