-
-
Notifications
You must be signed in to change notification settings - Fork 10.8k
BUG: Disallow shadowed modulenames #25181
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
# gh-22819 -- begin | ||
parser = make_f2py_parser() | ||
args, comline_list = parser.parse_known_args(comline_list) | ||
pyf_files, _ = filter_files("", "[.]pyf([.]src|)", comline_list) | ||
# Checks that no existing modulename is defined in a pyf file | ||
# TODO: Remove all this when scaninputline is replaced | ||
if "-h" not in comline_list and args.module_name: # Can't check what doesn't exist yet, -h creates the pyf | ||
modname = validate_modulename(pyf_files, args.module_name) | ||
comline_list += ['-m', modname] # needed for the rest of scaninputline | ||
# gh-22819 -- end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mattip, apart from the issues this closes, the PR is required for #25111, since the command invoked for building the modules used is
|
Makes sense, thanks @HaoZeke |
Backport needed if #25123 is to be backported. |
Asserting on a non-empty string literal will always pass This line had been added by numpy#25181 / 0f6e357 without any explanation. I believe it's an error because the assertion is a no-op. So remove it.
Asserting on a non-empty string literal will always pass This line had been added by numpy#25181 / 0f6e357 without any explanation. I believe it's an error because the assertion is a no-op. So remove it.
This is a better version of #25114.
Closes #22819. Closes #25182.
Enforces the following:
-m
is passed with a.pyf
in a-c
call, the name is ignored and taken from the.pyf
file (the only logical option)-c
run will only produce onepython
module, so there can only be one.pyf
file-m
is passed without-c
and.pyf
files are present (new, BUG:f2py
generates incorrect wrapper files when passed-m
and a.pyf
#25182)For the last point
-m blah
is internally replaced with-m modname
from the.pyf
file, so no additional (incorrect) wrappers are produced.There already is a note in the documentation, but this is a much better solution (and also paves the way for #25111). The documentation could probably use an update, and since this is technically a user facing change it might need a release note.