Support to print dataclasses and tuples in REPL#2785
Support to print dataclasses and tuples in REPL#2785ubaidsk merged 2 commits intolcompilers:mainfrom
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.
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. |
ubaidsk
left a comment
There was a problem hiding this comment.
Looks great, thanks for this!
Example: