Skip to content

Issues with List.pop() #1821

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

Closed
anutosh491 opened this issue May 17, 2023 · 1 comment · Fixed by #1845
Closed

Issues with List.pop() #1821

anutosh491 opened this issue May 17, 2023 · 1 comment · Fixed by #1845
Assignees

Comments

@anutosh491
Copy link
Collaborator

According to #941 , the pop method seems to be supported for lists . But we have the following errors on main

(lf) anutosh491@spbhat68:~/lpython/lpython$ cat examples/expr2.py 
def main0():
    x: list[i32]
    x = [1, 2, 3, 4]
    print(x.pop(), x)

main0()

(lf) anutosh491@spbhat68:~/lpython/lpython$ python examples/expr2.py 
4 [1, 2, 3]

Through Lpython

(lf) anutosh491@spbhat68:~/lpython/lpython$ cat examples/expr2.py 
def main0():
    x: list[i32]
    x = [1, 2, 3, 4]
    print(x.pop())

main0()

(lf) anutosh491@spbhat68:~/lpython/lpython$ lpython examples/expr2.py 
Internal Compiler Error: Unhandled exception
Traceback (most recent call last):
  Binary file "/home/anutosh491/lpython/lpython/src/bin/lpython", in _start()
  Binary file "/lib/x86_64-linux-gnu/libc.so.6", in __libc_start_main()
.......
  File "/home/anutosh491/lpython/lpython/src/libasr/../libasr/asr.h", line 4588, in ??
    case exprType::ListPop: { v.visit_ListPop((const ListPop_t &)x); return; }
LCompilersException: visit_ListPop() not implemented
(lf) anutosh491@spbhat68:~/lpython/lpython$ cat examples/expr2.py 
def main0():
    x: list[i32]
    x = [1, 2, 3, 4]
    x.pop()
    print(x)

main0()

(lf) anutosh491@spbhat68:~/lpython/lpython$ lpython examples/expr2.py 
Internal Compiler Error: Unhandled exception
Traceback (most recent call last):
...........
  File "/home/anutosh491/lpython/lpython/src/libasr/asr_utils.h", line 39, in ??
    return ASR::down_cast<ASR::stmt_t>(f);
AssertFailed: is_a<T>(*f)
@czgdp1807
Copy link
Collaborator

I have assigned this issue to @kabra1110. He will work on this as a part of his GSoC project.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants