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

Resolve change in InvalidNumber handling in writers #3390

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

jsiirola
Copy link
Member

@jsiirola jsiirola commented Oct 22, 2024

Fixes #3386 .

Summary/Motivation:

This resolves #3386 by making it so that both InvalidNumber.__str__ and InvalidNumber.__repr__ raise exceptions. It was relatively straightforward to remove the use of string conversions in the tests so that we no longer needed to cast InvalidNumber to a string.

Note that this includes an exception to the "str(InvalidNumber) raises an exception rule: if we are in the middle of processing an exception, this does not raise another exception and instead returns the old string representation.

Changes proposed in this PR:

  • Update InvalidNumber so that both str() and repr() raise exceptions
  • Clean up how some deprecation warnings generate warnings about NaN
  • Update tests

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.

Copy link
Member

@blnicho blnicho left a comment

Choose a reason for hiding this comment

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

I like this solution!

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.

Resolve (change in) IPOPT solver/NL writer exception type for problems with invalid constants
2 participants