Kristján Valur Jónsson wrote:
> 
> I noticed something (in 2.5) yesterday, which may be a feature, but is more 
> likely a bug.
> In tokenizer.c, tok->encoding is allocated using PyMem_MALLOC().
> However, this then gets handed to a node->r_str in parsetok.c, and then 
> released in node.c using PyObject_Free().
> 
> Now, by coincidence, PyObject_Free() will default to free() for objects that 
> it doesn't recognize, so this works.  But is this documented behavior?  The 
> reason I ran into this was that I had redirect the PyMem_* API to a different 
> allocator, but left the PyObject_* one alone.
> 
> My feeling Is that these two APIs shouldn't be interchangeable.  Especially 
> since you can't hand a PyObject_Malloc'd object to PyMem_Free() so the 
> inverse shouldn't be expected to work.
> 
> Any thoughts?

This is a bug. Please file a bug report for this.

In general, either PyObject_* xor PyMem_* memory API should used.

-- 
Marc-Andre Lemburg
eGenix.com

Professional Python Services directly from the Source  (#1, Sep 04 2009)
>>> Python/Zope Consulting and Support ...        http://www.egenix.com/
>>> mxODBC.Zope.Database.Adapter ...             http://zope.egenix.com/
>>> mxODBC, mxDateTime, mxTextTools ...        http://python.egenix.com/
________________________________________________________________________

::: Try our new mxODBC.Connect Python Database Interface for free ! ::::


   eGenix.com Software, Skills and Services GmbH  Pastor-Loeh-Str.48
    D-40764 Langenfeld, Germany. CEO Dipl.-Math. Marc-Andre Lemburg
           Registered at Amtsgericht Duesseldorf: HRB 46611
               http://www.egenix.com/company/contact/
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to