Caching objects in a C extension

Antoine Pitrou solipsis at pitrou.net
Fri Jan 8 17:56:33 CET 2010


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.





More information about the Python-list mailing list