Skip to content

BUG: Disallow shadowed modulenames #25205

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

Merged
merged 11 commits into from
Nov 20, 2023

Conversation

charris
Copy link
Member

@charris charris commented Nov 20, 2023

Backport of #25181 and #25185.

This is a better version of #25114.
Closes #22819. Closes #25182.
Enforces the following:

  • Warns (but doesn't break, for BC) when -m is passed with a .pyf in a -c call, the name is ignored and taken from the .pyf file (the only logical option)
  • Each -c run will only produce one python module, so there can only be one .pyf file
  • Will not write out ambiguous wrapper files when -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.

@charris charris added this to the 1.26.3 release milestone Nov 20, 2023
@charris
Copy link
Member Author

charris commented Nov 20, 2023

This seems to have a prerequisite backport. Will wait until more go in and rebase.

@charris
Copy link
Member Author

charris commented Nov 20, 2023

@HaoZeke Any ideas as to what is needed for this to work? It seems related to using the meson backend, but the meson.build.template file is not part of the compiled numpy. I'm guessing numpy is not compiled with meson in these failing tests.

@HaoZeke
Copy link
Member

HaoZeke commented Nov 20, 2023

@HaoZeke Any ideas as to what is needed for this to work? It seems related to using the meson backend, but the meson.build.template file is not part of the compiled numpy. I'm guessing numpy is not compiled with meson in these failing tests.

Yeah the problem is that test doesn't need to have --backend meson I guess. Although on 3.9 it should have been skipped, will update the skipif.

@charris
Copy link
Member Author

charris commented Nov 20, 2023

I think it might have been in numpy/f2py/setup.py. Lets see if this fixes things:

-        'backends/meson.build.template',
+        '_backends/meson.build.template',

@HaoZeke
Copy link
Member

HaoZeke commented Nov 20, 2023

I think it might have been in numpy/f2py/setup.py. Lets see if this fixes things:

-        'backends/meson.build.template',
+        '_backends/meson.build.template',

In general #25210 is better, runs the same test for filename on distutils and meson, so that's an option too. Though the typo definitely should be fixed!

@charris charris merged commit 80ecf9f into numpy:maintenance/1.26.x Nov 20, 2023
@charris charris deleted the backport-25181 branch November 20, 2023 22:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants