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 itamarst
Recipients itamarst
Date 2013-10-09.13:17:02
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1381324623.16.0.375897659555.issue19206@psf.upfronthosting.co.za>
In-reply-to
Content
In certain situations it is best to avoid doing file I/O. For example, a program that runs in an event loop may wish to avoid any potentially blocking operations; reading from a file usually is fast, but can sometimes take arbitrary long. Another example (my specific use case) is a logging library - you don't want to block for an arbitrary amount of time when creating log messages in an application thread (a separate thread would do the writing).

Unfortunately, the traceback.py module reads from files to load the source lines for the traceback (using linecache.py). This means if you want to format a traceback without file I/O you have to either recreate some logic from the standard library, monkey-patch globally, or do a terrible hack you don't want to know about.

It would be better if the there was some way to ask the traceback.py module's functions to not do file I/O. The actual change would be fairly minor I suspect since the formatting functions already support getting None back from linecache.
History
Date User Action Args
2013-10-09 13:17:03itamarstsetrecipients: + itamarst
2013-10-09 13:17:03itamarstsetmessageid: <1381324623.16.0.375897659555.issue19206@psf.upfronthosting.co.za>
2013-10-09 13:17:03itamarstlinkissue19206 messages
2013-10-09 13:17:02itamarstcreate