-
Notifications
You must be signed in to change notification settings - Fork 170
Segmentation fault in list.remove
#1701
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
Comments
I guess if an element is not present in the list then Python 3.9.6 (default, Mar 10 2023, 20:16:38)
[Clang 14.0.3 (clang-1403.0.22.14.1)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> l = [1, 2, 3]
>>> l.remove(4)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ValueError: list.remove(x): x not in list |
You can follow the same pattern as done by Python. Checked with Python 3.10.4 and its still the same. We can worry about beautification later (nice to have for usability but something which should happen later). |
Agreed. I tried the suggested change (to just print I think this is due to control going ahead of the |
With an element not present in the list, the error-message printing of
list.remove
segfaults.This appears to be due to the
%d
in("ValueError: %s%d\n")
here (assumes an integer).I think the solution is to split this into cases, but I am not exactly sure on how to handle
item
being list, tuple, etc.The text was updated successfully, but these errors were encountered: