[Python-3000] PEP 3134 exception reporting
Antoine Pitrou
solipsis at pitrou.net
Sun Jun 22 00:15:29 CEST 2008
Hi,
I have implemented PEP 3134 exception reporting in http://bugs.python.org/issue3112
The code is fully functional but it needs a final clean-up and that clean-up
is awaiting answers to the following questions:
1) API visibility: should we expose a function PyErr_DisplaySingle in order
to display an exception without chaining (while PyErr_Display displays
all chained exceptions)?
2) API change: should those two functions (PyErr_Display / PyErr_DisplaySingle)
be changed to return an integer result (0: success, -1: failure)? In any case
they would continue swallow all errors, the result code would just be a means
for the calling code to know whether everything went well.
3) Optional question: should be harmonize traceback formatting between built-in
reporting and reporting through traceback.py? Right now there is a small
discrepancy in code lines indentation, see:
With built-in reporting:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "f.py", line 22, in raise_cause
inner_raise_cause()
File "f.py", line 13, in inner_raise_cause
raise KeyError from e
KeyError
With traceback.py:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "f.py", line 22, in raise_cause
inner_raise_cause()
File "f.py", line 13, in inner_raise_cause
raise KeyError from e
KeyError
Thanks in advance for your advice
Antoine.
More information about the Python-3000
mailing list