New submission from Itamar Turner-Trauring:

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.

----------
components: Library (Lib)
messages: 199294
nosy: itamarst
priority: normal
severity: normal
status: open
title: Support disabling file I/O when doing traceback formatting
type: enhancement

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue19206>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to