-
Notifications
You must be signed in to change notification settings - Fork 323
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
Avoid StackOverflow when comparing unknown foreign objects #7780
Conversation
…ing stack overflow. Rely on InteropLibrary.isIdentical
...ntime/src/main/java/org/enso/interpreter/node/expression/builtin/meta/EqualsComplexNode.java
Show resolved
Hide resolved
...ntime/src/main/java/org/enso/interpreter/node/expression/builtin/meta/EqualsComplexNode.java
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I understand that a StackOverflow error when comparing numpy arrays is problematic and have to be fixed. But I am not sure I completely agree with this kind of simplification of equalsInteropObjectWithMembers
. What about a compromise - keep the old version, but checking of member values would not be implemented with a child equalsNode
, but rather with isIdentical
interop message?
...ntime/src/main/java/org/enso/interpreter/node/expression/builtin/meta/EqualsComplexNode.java
Show resolved
Hide resolved
What would be a point of a compromise? How could one explain that to users? Any important use-case that are covered by such a compromise? I could think of JSON, but there is a proper API for JSON in Enso and that one does |
I guess you are right. I cannot think of any important use case for the compromise that I have suggested. Let's just keep it simple and check for |
Pull Request Description
Closes #7677 by eliminating the stackoverflow execption. In general it seems too adventurous to walk members of random foreign objects. There can be anything including cycles. Rather than trying to be too smart in these cases, let's just rely on
InteropLibrary.isIdentical
message.Important Notes
Calling
sort
on thenumpy
array no longer yields an error, but the array isn't sorted - that needs a fix on the Python side: oracle/graalpython#354 - once it is in, the elements will be treated as numbers and the sorting happens automatically (without any changes in Enso code).Checklist
Please ensure that the following checklist has been satisfied before submitting the PR:
Java,