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

Change from %r to %s for NumPy 2.0 compatibility #3353

Merged
merged 3 commits into from
Aug 20, 2024

Conversation

orthorhombic
Copy link
Contributor

Fixes #3352

Summary/Motivation:

This changes %r to %s in the nl_writer for NumPy 2.0 compatibility. I believe this was missed in #3292

Changes proposed in this PR:

const = 'n%r\n' gets changed to const = 'n%s\n'

Legal Acknowledgement

By contributing to this software project, I have read the contribution guide and agree to the following terms and conditions for my contribution:

  1. I agree my contributions are submitted under the BSD license.
  2. I represent I am authorized to make the contributions and grant the license. If my employer has rights to intellectual property that includes these contributions, I represent that I have received permission to make contributions and grant the required license on behalf of that employer.

@orthorhombic
Copy link
Contributor Author

@mrmundt & @jsiirola - Just figured I'd tag you here for awareness based on your work with #3292

@mrmundt
Copy link
Contributor

mrmundt commented Aug 19, 2024

Thanks, @orthorhombic ! Could you do me a favor and add a small test that ensures the right behavior is happening? Tests for the NL writer can be found in: https://github.com/Pyomo/pyomo/tree/main/pyomo/repn/tests/ampl <- most likely the test_nlv2.py file would be the best bet, but do what feels right.

If you need help, let us know.

@jsiirola
Copy link
Member

@orthorhombic: Thank you for catching & resolving this! This is an important catch / fix ... I took the liberty of resolving a merge conflict and adding a test so that we can get this reviewed and merged for the next release (tomorrow!!).

Copy link
Member

@jsiirola jsiirola left a comment

Choose a reason for hiding this comment

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

Approved, pending successful tests.

@orthorhombic
Copy link
Contributor Author

orthorhombic commented Aug 19, 2024

Sorry I'm just catching up on messages here. Thanks for the quick turnaround, and that this could make it into the next release!

If anything comes up, I can take a look a bit later.

Copy link

codecov bot commented Aug 20, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 88.60%. Comparing base (ccc96bf) to head (f3a07ed).
Report is 109 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #3353   +/-   ##
=======================================
  Coverage   88.59%   88.60%           
=======================================
  Files         874      874           
  Lines       99124    99124           
=======================================
+ Hits        87822    87831    +9     
+ Misses      11302    11293    -9     
Flag Coverage Δ
linux 86.13% <100.00%> (ø)
osx 75.80% <100.00%> (ø)
other 86.64% <100.00%> (+<0.01%) ⬆️
win 83.96% <100.00%> (+0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@blnicho blnicho merged commit 5a5b13a into Pyomo:main Aug 20, 2024
32 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
Development

Successfully merging this pull request may close these issues.

NL file contains np.float64(0.0)
5 participants