alexmojaki/futurecoder

Handle MemoryError more gracefully

alexmojaki opened this issue · 2 comments

e.g. this code ran by a user:

numbers = [3, 1, 4, 1, 5, 9, 2, 6, 5]
new_numbers = []
for num in numbers:
    numbers += [num*2]

print(numbers)

leads to a MemoryError. It should just display something sensible in the console without crashing everything, showing an error dialog, reporting to sentry, etc.

error-explainer may be helpful. (If not, you can delete this comment.)

Hi @rootsmusic, I appreciate your interest in this project and I don't want to delete your comment. error-explainer looks similar to friendly-traceback which futurecoder uses, although I think I trust friendly-traceback more. In any case the problem is not explaining the error for beginners, it's that when all memory has been exhausted then the error handling (including traceback formatting and explaining) fails from lack of memory.