Open Kishan-Ved opened 4 months ago
@certik Sir the error seems weird. Can we rerun this?
Also, I noticed that many intrinsic functions like Trailz don't have integration tests.
Edit: I have fixed the windows CI error in https://github.com/lcompilers/lpython/pull/2562
Please mark this PR ready for review once it is ready.
The test fails for cpython, may I please know the reason. The error is:
Traceback (most recent call last):
File "/home/kishan/Desktop/lpython/integration_tests/intrinsics_03.py", line 8, in <module>
print(lshift(a,b))
NameError: name 'lshift' is not defined
The file runs when I do ./src/bin/lpython integration_tests/intrinsics_03.py
and gives the correct output.
Do I need to make more additions to some files?
It fails because, python doesn't have builtin lshift support. I think it needs to be imported from the operator module, see: https://docs.python.org/3/library/operator.html#operator.lshift. Something like:
from operator import lshift
print(lshift(x, y))
Does x << y
work in lpython?
It fails because, python doesn't have builtin lshift support. I think it needs to be imported from the operator module, see: https://docs.python.org/3/library/operator.html#operator.lshift. Something like:
from operator import lshift print(lshift(x, y))
Does
x << y
work in lpython?
Yes, x<<y
works in lpython. Also, you are right, lshift()
needs to be imported from the operator module and is not built in python.
It fails because, python doesn't have builtin lshift support. I think it needs to be imported from the operator module, see: https://docs.python.org/3/library/operator.html#operator.lshift. Something like:
from operator import lshift print(lshift(x, y))
Does
x << y
work in lpython?
I want lshift to be imported only for the python test. For LPython's implementation, I want the control to be redirected to my intrinsic function. How can I achieve this? Or should we include the cpython test later, when we implement the operator module for LPython, and there we redirect control to this intrinsic?
cc @Thirumalai-Shaktivel @Shaikh-Ubaid
I thought this would be a good one to get started with LPython implementations.
Reference: https://docs.python.org/3/library/operator.html#operator.lshift