sys.stderr and PyErr_WriteUnraisable
Jan Langer
jan.langer at etit.tu-chemnitz.de
Tue Dec 15 09:17:20 EST 2009
Hi all,
I am using Python 2.6 and with the following code I expect a different
result:
from test.test_support import captured_output
with captured_output("stderr") as stderr:
def g():
try:
g()
except RuntimeError,e:
pass
g()
print stderr.getvalue()
I expect the ignored exceptions to be printed into the StringIO object
stderr. With this code there are no warnings on the command line, but
getvalue() returns nothing.
I looked a little into Python and the warnings are printed from
PyErr_WriteUnraisable to sys.stderr.
Is this code supposed to work as I expect it or am I missing something?
thanks,
Jan
More information about the Python-list
mailing list