ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> ctypes-users
ctypes-users
Re: [ctypes-users] PYFUNCTYPE, py_object and reference counting
by Lenard Lindstrom other posts by this author
Nov 24 2006 2:01PM messages near this date
Re: [ctypes-users] PYFUNCTYPE, py_object and reference counting | Re: [ctypes-users] PYFUNCTYPE, py_object and reference counting
On 21 Nov 2006 at 19:48, Thomas Heller wrote:

>  Lenard Lindstrom schrieb:
>  > Forgive me if this has been discussed before. For Python api 
>  > functions does ctypes assume a py_object return type is a new 
>  > reference and a py_object argument is a borrowed reference? 
>  > PyList_GetItem returns a borrowed reference. PyList_SetItem steals a 
>  > reference. I see no reason to call these functions directly. However, 
>  > since they are accessible from ctypes it makes sense that either it 
>  > can handle them correctly or they are  documented as unsafe to use.
>  
>  py_object works in the way that one would expect with functions returning
>  new references, and *not* stealing a refcount from the argument.
>  For other functions it is required to adjust the refcount manually
>  with _ctypes.Py_INCREF and _ctypes.Py_DECREF.
>  
>  When I have time I will document that; patches would of course also
>  be appreciated.
>  
Patch submitted to ctypes at sourceforge.

Lenard Lindstrom
<len-l@[...].net> 



-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
ctypes-users mailing list
ctypes-users@[...].net
https://lists.sourceforge.net/lists/listinfo/ctypes-users
Thread:
Lenard Lindstrom
Thomas Heller
Lenard Lindstrom
Thomas Heller

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved