[Python-Dev] segfault (double free?) when '''-string crosses line

Neal Norwitz nnorwitz at gmail.com
Mon Apr 10 05:31:44 CEST 2006


On 4/9/06, Tim Peters <tim.peters at gmail.com> wrote:
> [Guido]
> > On Linux, In HEAD 2.5, but only with the non-debug version, I get a
> > segfault when I do this:
> >
> > >>> '''
> > ... '''
>
> It rings a bell here only in that the front end had lots of
> allocate-versus-free mismatches between the PyObject_ and PyMem_
> raw-memory APIs, and this kind of failure smells a lot like that.

http://python.org/sf/1467512 fixes the problem for me on linux.  It
converts all the PyMem_* APIs to PyObject_* APIs.  Assigned to Guido
until he changes that. :-)

There are several more places in the core that should probably use
PyObject_* memory APIs since the alloced memory is small.  412 uses of
PyMem_* in */*.c.  Most of those are in modules where it is probably
appropriate.  But PyFutureFeatures could really use PyObject_* given
it's only 8 bytes. (Python/future.c and Python/compile.c).

Modules/_bsddb.c has a scary line:  #define PyObject_Del PyMem_DEL

n


More information about the Python-Dev mailing list