This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author vstinner
Recipients ezio.melotti, michael.foord, pitrou, serhiy.storchaka, vstinner
Date 2015-04-01.11:47:52
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1427888872.4.0.00800361691649.issue23838@psf.upfronthosting.co.za>
In-reply-to
Content
> Proposed patch clears the cache and repeats an attempt to read source file, and returns empty result if the second attempt fails (as when the source file can't be read).

IMO it's a bad idea. You should not retry an operation on MemoryError but only do you best to limit errors.

I don't think that it's correct to return an empty list for getlines() on MemoryError. So you maybe chose the wrong module: you should handle MemoryError in the traceback module, not in the linecache module.

It's just fine to return an empty string for FrameSummary.line. It's common to not being able to display a line: because the .py was removed (only the .pyc is available), invalid line number, invalid filename ("<string>" or "<stdin>"), etc.

If you are motivated to make the traceback module more reliable, you should maybe also enhance _Py_DisplaySourceLine() in Python/traceback.c. You can probably ignore almost all errors in  _Py_DisplaySourceLine() ("except (Exception, MemoryError): pass").
History
Date User Action Args
2015-04-01 11:47:52vstinnersetrecipients: + vstinner, pitrou, ezio.melotti, michael.foord, serhiy.storchaka
2015-04-01 11:47:52vstinnersetmessageid: <1427888872.4.0.00800361691649.issue23838@psf.upfronthosting.co.za>
2015-04-01 11:47:52vstinnerlinkissue23838 messages
2015-04-01 11:47:52vstinnercreate