-
Notifications
You must be signed in to change notification settings - Fork 171
Adding support for is_integer attribute #2686
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
Conversation
Ready ! |
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.
There is a failure at the CI. Apart from that this looks good.
Hmm, pretty weird, I wasn't expecting any test to fail. You can quickly check the results on sympy live (https://live.sympy.org/), A WebAssembly-powered Python kernel backed by Pyodide |
@certik could you maybe try having a look ? |
@anutosh491 The following diff fixes the issue for me: diff --git a/src/runtime/lpython/lpython.py b/src/runtime/lpython/lpython.py
index 9f23b02e9..a8b88ac6f 100644
--- a/src/runtime/lpython/lpython.py
+++ b/src/runtime/lpython/lpython.py
@@ -15,6 +15,10 @@ __slots__ = ["i8", "i16", "i32", "i64", "u8", "u16", "u32", "u64", "f32", "f64",
# data-types
+def get_sympy_S(x):
+ from sympy import S
+ return S(x)
+
type_to_convert_func = {
"i1": bool,
"i8": int,
@@ -34,7 +38,7 @@ type_to_convert_func = {
"Callable": lambda x: x,
"Allocatable": lambda x: x,
"Pointer": lambda x: x,
- "S": lambda x: x,
+ "S": get_sympy_S,
}
class Type: |
Hey thanks Ubaid, I think this might fix the issue for us. |
We should clean the commit history or squash merge this. |
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.
It looks good. Thanks for this! Amazing work!
This Pr is trying to support the following case (and is also required for the gruntz algorithm)