-
Notifications
You must be signed in to change notification settings - Fork 24
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
Support for Python "infinity" value for MZNJSONEncoder #126
Comments
Are you referring to the floating point infinity values in Python? I suppose they would be the way handle infinity in Python. However, I'm not sure whether MiniZinc's JSON parser is setup to do handle any type of Infinity value. I don't really see any mention of infinity in the JSON spec: https://www.json.org/json-en.html |
According to Python's json lib,
I believe this could be handled in |
I'm actually not sure whether this could be handled by the Apart from that, you seem to be under the impression that Using the json
So maybe the right way to change this is for MiniZinc's json parser to accept what Python will already output. I don't think I particularly mind this, but I am a little wary of the fact that this would mean that you wouldn't be able to tell whether something was an integer or an floating point value |
You are right, so it seems there is no way to override Python's JSONEncoder for specific numeric values.
You are also right. MiniZinc's JSON parser is not able to handle (yet) the "infinity" string for numerical values, which was a wrong assumption on my side.
I think this is it. MiniZinc JSON parser should at least understand an "infinity" string, whether it is with a capital letter or not. In the meantime, I suggest that you set |
Using Python infinity value in the MiniZinc data is encoded in JSON as "Infinity" instead of "infinity", which makes MiniZinc crash. I believe the best way would be to change MZNJSONEncoder to support that or forbid this conversion to happen.
The text was updated successfully, but these errors were encountered: