Re: [Python-Dev] PyErr_ Fetch | Restore & friends

2014-03-29 Thread Ethan Furman
On 03/29/2014 01:47 PM, Nick Coghlan wrote: On 30 March 2014 03:05, Ethan Furman wrote: This bit of code won't even finish compiling. I am not sure if my understanding of references (and how these functions create/consume them) or my understanding of when and where to call PyErr_Fetch|Restore

Re: [Python-Dev] PyErr_ Fetch | Restore & friends

2014-03-29 Thread Nick Coghlan
On 30 March 2014 03:05, Ethan Furman wrote: > > This bit of code won't even finish compiling. I am not sure if my > understanding of references (and how these functions create/consume them) or > my understanding of when and where to call PyErr_Fetch|Restore or > PyException_SetContext is at fault

[Python-Dev] PyErr_ Fetch | Restore & friends

2014-03-29 Thread Ethan Furman
I'm working on issue 1615 [1] and came up with this tidbit, which works [2], but not well enough: slot_tp_getattr_hook(PyObject *self, PyObject *name) { ... +PyObject *error_type, *error_value, *error_traceback; ... +/* if an AttributeError is set, save it and call getattr; i