[C-API] Weird sys.exc_info reference segfault

Jonas H. jonas at lophus.org
Sun Oct 3 14:44:32 CEST 2010


On 10/03/2010 01:16 AM, Antoine Pitrou wrote:
> You should check that you aren't doing anything wrong
> with "env" and "start_response" (like deallocate them forcefully).

I commented out the `Py_DECREF(start_response)` after the `app` call and 
the crash was gone. `start_response` is created via `PyObject_NEW` on 
run time for every `app` call and `PyObject_FREE`d after that call.

I do not understand why I'm not supposed to DECREF the start_response 
callable after the call -- doesn't a function INCREF its arguments when 
called, so I'm free to DECREF them?  If not, how can I know at which 
point of time I can safely do the DECREF?

Jonas



More information about the Python-list mailing list