[Python-Dev] Borrowed and Stolen References in API

Mark Shannon marks at dcs.gla.ac.uk
Fri May 6 09:44:11 CEST 2011


skip at pobox.com wrote:
>     Georg> Let's remove the cruft, and only keep interesting info.  This
>     Georg> will also make the file much more manageable.
> 
> If I was to do this from scratch I'd think hard about annotating the source
> code.  No matter how hard you try, if you keep this information separate
> from the code and maintain it manually, it's going to get out-of-date.
> 
What about #defining PY_STOLEN in some header?

Then any stolen parameter can be prefixed with PY_STOLEN in signature.

For return values, similarly #define PY_BORROWED.

Cheers,
Mark.


More information about the Python-Dev mailing list