TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


Forums >


Re: [C-API] malloc error in PyDict_New

Stefan Behnel

3/26/2010 7:42:00 PM

Jonas H., 26.03.2010 20:10:
> I'm currently diving into Python C programming and I have a problem with
> `PyDict_New`.
> My application receives a SIGABRT from malloc every time I execute
> `PyDict_New`. malloc throws the following error:
> malloc.c:3096: sYSMALLOc: Assertion `(old_top == (((mbinptr) (((char *)
> &((av)->bins[((1) - 1) * 2])) [snip]' failed.

In case this code is not called from within Python but from some kind of
network layer callback (maybe in a thread created by C code?), you will
have to set up a Python interpreter environment for such a thread first.
See the PyInterpreterState and PyThreadState functions here: