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

Fix edge case assigning new numeric types to Var/Param with units #3151

Merged
merged 2 commits into from
Feb 20, 2024

Conversation

jsiirola
Copy link
Member

Fixes #3100 .

Summary/Motivation:

#3100 highlighted a gap in the automatic type registration logic (which @andrewlee94 noted also led to IDAES test failures). This PR closes that hole and ensures that type registrations that occur through Param or Var set_value() are handled gracefully.

Changes proposed in this PR:

  • Recheck the native_numeric_types after calling value()
  • Add tests of the observed error

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.

pyomo/core/base/param.py Outdated Show resolved Hide resolved
pyomo/core/base/param.py Outdated Show resolved Hide resolved
@blnicho blnicho merged commit 21a718a into Pyomo:main Feb 20, 2024
2 of 26 checks passed
@jsiirola jsiirola deleted the numpy-registration-and-var-units branch February 20, 2024 23:58
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.

Make physical units check trigger for _GeneralVarData.set_value more consistent
3 participants