[Python-Dev] Borrowed and Stolen References in API (original) (raw)
Antoine Pitrou solipsis at pitrou.net
Thu May 5 20:09:30 CEST 2011
- Previous message: [Python-Dev] Borrowed and Stolen References in API
- Next message: [Python-Dev] Borrowed and Stolen References in API
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Thu, 5 May 2011 19:17:30 +0200 "Amaury Forgeot d'Arc" <amauryfa at gmail.com> wrote:
2011/5/5 Guido van Rossum <guido at python.org>: > Seems you're in agreement with this. IMO when references are borrowed > it is not very interesting. The interesting thing is when calling a > function steals a reference. The other important thing to know is > whether the caller ends up owning the return value (if it is an > object) or not. I think you can tell the latter from the +1 for the > return value; but the former (whether it steals a reference) is > unclear from the data given. There's even an XXX comment about this in > the file: > > # XXX NOTE: the 0/+1/-1 refcount information for arguments is > # confusing! Much more useful would be to indicate whether the > # function "steals" a reference to the argument or not. Take for > # example PyListSetItem(list, i, item). This lists as a 0 change for > # both the list and the item arguments. However, in fact it steals a > # reference to the item argument!
Should we change this file then? And only list functions that don't follow the usual conventions.
+1
Regards
Antoine.
- Previous message: [Python-Dev] Borrowed and Stolen References in API
- Next message: [Python-Dev] Borrowed and Stolen References in API
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]