[Python-3000] Delayed reference counting idea

Jim Jewett jimjjewett at gmail.com
Mon Sep 18 22:33:09 CEST 2006

On 9/18/06, Barry Warsaw <barry at python.org> wrote:

>  ... I agree with Raymond that it can be quite difficult to get
> C code to be refcount-correct, ...

How much of this (particularly for beginners) is remembering the
refcount affects of standard functions?  Could this be avoided by just
always using the more abstract interface?  (Sequence instead of List,
Mapping instead of Dict)

> The really tricky thing about refcounting is making sure all the exit
> conditions out of a function are refcount correct.  Usually these
> involve error or exception conditions, and they can be a bear to get
> right.

Would it solve this problem if there were a PyTEMPREF that magically
treated the refcount as an automatic variable?  (It increfed
immediately, and decrefed whenever the function exited, without the
user having to track this manually.)

Would it help enough to justify a pre-processing requirement?


More information about the Python-3000 mailing list