[Python-Dev] Low-level exception invariants?

Tim Peters tim.peters at gmail.com
Fri May 26 19:46:59 CEST 2006


[Guido]
> +1, if you can also prove that the traceback will never be null. I
> failed at that myself last time I tried, but I didn't try very long or
> hard.

Thanks!  I'm digging.

Stuck right now on this miserable problem that's apparently been here
forever:  I changed PyErr_SetObject to start like so:

"""
PyErr_SetObject(PyObject *exception, PyObject *value)
{
	   assert(exception != NULL);
"""

This triggered instantly upon firing up Python, and it is was _called_ via

    PyErr_Format(PyExc_AttributeError, ...

!  I thought I had gone insane, until I realized this happens during
_PyExc_Init():  that can try to raise exceptions before the exception
pointers have been initialized.  So long as we can get into exception
machinery while the exception objects point to trash, there aren't
many useful invariants ;-)


More information about the Python-Dev mailing list