-
Notifications
You must be signed in to change notification settings - Fork 165
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 to print dataclasses and tuples in REPL #2785
Support to print dataclasses and tuples in REPL #2785
Conversation
src/lpython/tests/test_llvm.cpp
Outdated
r = e.evaluate2("c4"); | ||
CHECK(r.ok); | ||
CHECK(r.result.type == PythonCompiler::EvalResult::struct_type); | ||
CHECK(e.aggregate_type_to_string(r.result) == "MyClass4(i_1=True, i_8=2, i_16=3, i_32=4, i_64=5)"); |
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 like this line fails on Windows. (1639)
Commenting this one line and running the test does not seg fault in my local machine.
On further investigation, it looks like when we get the offset of each member field of the struct from LLVM, it returns a random value (reference: lpython/src/lpython/python_evaluator.cpp Lines 534 to 535 in c58d31c
I am printing out the offsets, and just before it seg faults the offset values are random and high.
Is this a bug in LLVM? |
Could you please share the test code and the offset printing modification you used here?
Which LLVM version are you currently using? Could you please check with other LLVM versions? |
I have tested it with both LLVM 11 and 16. It fails similarly in both. Code used to debug:
|
ea2fc92
to
ae9c730
Compare
d9285d7
to
ae9c730
Compare
@Shaikh-Ubaid, please have a look at the PR. I believe it is ready to be merged. I have commented out the failing test and opened an issue #2793. |
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 great, thanks for this!
Example: