lcompilers / lpython

Python compiler
https://lpython.org/
Other
1.37k stars 156 forks source link

Fix segmentation fault if item is not in the list #2751

Open advikkabra opened 2 days ago

advikkabra commented 2 days ago

Previously, if a string was not in a list and you try to remove it, a segmentation fault would occur since we would try to access the element at the nth position, if the list has n elements. I have refactored the code so that this access does not happen. I also rewrote the error statement to correctly get the type, if it is a string.