Skip to content

Issues with List.pop() #1821

Closed
Closed
@anutosh491

Description

@anutosh491

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)

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions