[C-API] malloc error in PyDict_New
stefan_ml at behnel.de
Fri Mar 26 20:41:50 CET 2010
Jonas H., 26.03.2010 20:10:
> I'm currently diving into Python C programming and I have a problem with
> 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:
More information about the Python-list