Skip to content

BUG: Handle common blocks with kind specifications from modules #25186

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 5 commits into from
Nov 19, 2023

Conversation

HaoZeke
Copy link
Member

@HaoZeke HaoZeke commented Nov 19, 2023

Closes #19161. Draft until:

  • Test

@HaoZeke HaoZeke marked this pull request as ready for review November 19, 2023 10:44
@@ -64,22 +64,22 @@
typedefs['unsigned_short'] = 'typedef unsigned short unsigned_short;'
typedefs['unsigned_long'] = 'typedef unsigned long unsigned_long;'
typedefs['signed_char'] = 'typedef signed char signed_char;'
typedefs['long_long'] = """\
typedefs['long_long'] = """
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are these removals an integral part of this PR?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yup, these should really have proper C tests (someday, #21304). Here what's happening is when they are in use, without the preprocessor directives come on the same line (a syntax error). Consider:

int 32;

Now with one of these needed typedefs it becomes something like (before the change):

int 32;#ifdef

Which is wrong, and needs to be (and is after this change):

int 32;
#ifdef

@mattip
Copy link
Member

mattip commented Nov 19, 2023

This is F90, not F77, right? Is there a way to specify F77/F90 in f2py?

Does this need a release note?

@HaoZeke
Copy link
Member Author

HaoZeke commented Nov 19, 2023

This is F90, not F77, right? Is there a way to specify F77/F90 in f2py?

No, we let the compiler figure it out now. There's internal handling for some of the code paths, but not really exposed to the user. I believe it is based on the file extension, but it is pretty liberal about switching to F90 at any point. In general its fine to let the compiler figure it out, especially since at this point, most F77 code is "corrupted" by some F90 feature or the other.

Does this need a release note?

I'm not sure, it is a very niche use case I would assume, since common blocks aren't in use anymore, I wil add one though. I'm hoping to cleanup the current documentation to use modern fortran and relegate these kind of F77 / F90 mixtures to an appendix..

@mattip mattip merged commit 907ccc3 into numpy:main Nov 19, 2023
@mattip
Copy link
Member

mattip commented Nov 19, 2023

Thanks @HaoZeke. As for the release note, a general note about progress with f2py is probably better.

@charris charris added the 09 - Backport-Candidate PRs tagged should be backported label Nov 19, 2023
@charris charris removed the 09 - Backport-Candidate PRs tagged should be backported label Nov 21, 2023
@HaoZeke HaoZeke deleted the gh-19161 branch December 1, 2023 20:01
@HaoZeke HaoZeke restored the gh-19161 branch June 15, 2024 23:40
@HaoZeke HaoZeke deleted the gh-19161 branch November 4, 2024 01:37
HaoZeke added a commit to HaoZeke/numpy that referenced this pull request Nov 4, 2024
charris pushed a commit to charris/numpy that referenced this pull request Nov 17, 2024
ArvidJB pushed a commit to ArvidJB/numpy that referenced this pull request Jan 8, 2025
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.

f2py - f2cmap fails on common blocks in f90
3 participants