[Python-Dev] ast-objects branch created

Nick Coghlan ncoghlan at gmail.com
Tue Dec 6 12:44:12 CET 2005


Neal Norwitz wrote:
> This is my understanding of the two approaches from what I've seen so
> far (Jeremy or Martin should correct me if I'm wrong).
> 
> With current arena impl:
>  * need to call PyArena_AddPyObject() for any allocated PyObject
>  * need to call PyArena_AddMallocPointer() for any malloc()ed memory
> (there are current no manual calls like this, all the calls are in
> generated code?)
> 
> With the PyObject imp:
>  * need to init all PyObjects to NULL
>  * need to Py_XDECREF() on exit
>  * need to goto error if there is any failure
> 
> Both impls have a bit more details, but those are the highlights. 
>>From what I've seen of both, the arena is easier to deal with even
> though it is different from the rest of python.  There is only one
> thing to remember.

As Fredrik pointed out a while back, the PyObject approach doesn't *have* to 
involve manual decref operations - PyObject's come with a ready made arena 
structure, in the form of PyList.

However, whether the automatic management is done with a list or with Jeremy's 
arena structure, the style is still different from most of CPython, and either 
way there's going to be a small learning curve associated with getting used to it.

Cheers,
Nick.

-- 
Nick Coghlan   |   ncoghlan at gmail.com   |   Brisbane, Australia
---------------------------------------------------------------
             http://www.boredomandlaziness.org


More information about the Python-Dev mailing list