Skip to content
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

Fixed f2py string intent #262

Merged
merged 3 commits into from
Feb 18, 2023
Merged

Fixed f2py string intent #262

merged 3 commits into from
Feb 18, 2023

Conversation

sseraj
Copy link
Collaborator

@sseraj sseraj commented Feb 17, 2023

Purpose

numpy 1.22 introduced some changes to how array dimensions are determined with f2py. From what I can tell, intent(out) strings of undetermined length are no longer valid (or have never been valid but did not previously raise an error).

ADflow has 4 string variables with intent(inout) that cause problems with numpy 1.22. I posted the error message in #256. However, we never use these variables in Python after passing them to Fortran, so I changed them to intent(in). This fixes the error and does not change the behavior of the code.

Expected time until merged

1 week

Type of change

  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (non-backwards-compatible fix or feature)
  • Code style update (formatting, renaming)
  • Refactoring (no functional changes, no API changes)
  • Documentation update
  • Maintenance update
  • Other (please describe)

Testing

I installed numpy 1.22, recompiled ADflow with these changes, and checked that all tests pass.

Checklist

  • I have run flake8 and black to make sure the Python code adheres to PEP-8 and is consistently formatted
  • I have formatted the Fortran code with fprettify or C/C++ code with clang-format as applicable
  • I have run unit and regression tests which pass locally with my changes
  • I have added new tests that prove my fix is effective or that my feature works
  • I have added necessary documentation

@sseraj sseraj requested a review from a team as a code owner February 17, 2023 15:27
marcomangano
marcomangano previously approved these changes Feb 17, 2023
Copy link
Contributor

@marcomangano marcomangano left a comment

Choose a reason for hiding this comment

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

This looks good, nice catch. I guess the only way to test this would be to bump numpy version on latest images?

@sseraj
Copy link
Collaborator Author

sseraj commented Feb 17, 2023

Yes, we can't test this on Azure without updating the Docker images. I tested this locally using a Docker image, so you can try that to verify the fix.

@codecov
Copy link

codecov bot commented Feb 17, 2023

Codecov Report

Merging #262 (69b0ada) into main (c750279) will not change coverage.
The diff coverage is n/a.

@@           Coverage Diff           @@
##             main     #262   +/-   ##
=======================================
  Coverage   40.77%   40.77%           
=======================================
  Files          13       13           
  Lines        3882     3882           
=======================================
  Hits         1583     1583           
  Misses       2299     2299           

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

Copy link
Collaborator

@joanibal joanibal left a comment

Choose a reason for hiding this comment

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

Nice

@joanibal joanibal merged commit 92fb234 into main Feb 18, 2023
@marcomangano marcomangano deleted the intent-fix branch February 18, 2023 20:15
@bustinov bustinov mentioned this pull request Apr 29, 2023
eirikurj pushed a commit to eirikurj/adflow that referenced this pull request Nov 8, 2023
* fixed f2py string intent

* update numpy requirement
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants