Caching objects in a C extension

casevh casevh at gmail.com
Fri Jan 8 23:33:45 EST 2010


On Jan 8, 8:56 am, Antoine Pitrou <solip... at pitrou.net> wrote:
> Le Fri, 08 Jan 2010 08:39:17 -0800, casevh a écrit :
>
>
>
> > Thanks for the reply. I realized that I missed one detail. The objects
> > are created by the extension but are deleted by Python. I don't know
> > that an object is no longer needed until its tp_dealloc is called. At
> > that point, its reference count is 0.
>
> tuple objects and others already have such a caching scheme, so you could
> download the Python source and look at e.g. Objects/tupleobject.c to see
> how it's done.
>
> Regards
>
> Antoine.

Thanks. That's exactly the information I was looking for.

casevh



More information about the Python-list mailing list