[issue19206] Support disabling file I/O when doing traceback formatting

2020-12-31 Thread Irit Katriel


Change by Irit Katriel :


--
stage:  -> resolved
status: pending -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19206] Support disabling file I/O when doing traceback formatting

2020-12-15 Thread Irit Katriel


Irit Katriel  added the comment:

Since this issue was created, the traceback module changed considerably, and 
now we have the TracebackException/StackSummary classes which capture 
information about an exception for later rendering. The lookup_lines arg 
controls the timing of the file access: if it is false, this is delayed until 
render-time.

I believe this solves the use case of the logger - the file access can be 
delayed till the logger thread renders the exception. I'm not sure I understand 
the event loop use case, but presumably there, too, the exceptions are not 
being rendered (because we don't want IO during that loop).

--
nosy: +iritkatriel
resolution:  -> out of date
status: open -> pending
versions:  -Python 3.9

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19206] Support disabling file I/O when doing traceback formatting

2020-11-04 Thread Irit Katriel


Change by Irit Katriel :


--
versions: +Python 3.10, Python 3.9

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19206] Support disabling file I/O when doing traceback formatting

2013-10-10 Thread STINNER Victor

STINNER Victor added the comment:

> Unfortunately, the traceback.py module reads from files to load the source 
> lines for the traceback (using linecache.py).

linecache is supposed to cache the result. When all files generating tracebacks 
of your project are cached, only os.stat() is called on each file to check if 
the file has been modified.

But I'm not sure I understood your request: do you want the line content in 
your traceback or not? If you don't want the line content, the traceback module 
should be modified to add an option "don't read file content".

--
nosy: +haypo

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19206] Support disabling file I/O when doing traceback formatting

2013-10-09 Thread Itamar Turner-Trauring

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 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com