[ python-Bugs-1533481 ] CTypes _as_parameter_ not working as documented

SourceForge.net noreply at sourceforge.net
Thu Aug 3 00:13:43 CEST 2006


Bugs item #1533481, was opened at 2006-08-02 16:11
Message generated for change (Comment added) made by shane_holloway
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1533481&group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: None
Group: Python 2.5
Status: Open
Resolution: None
Priority: 5
Submitted By: Shane Holloway (shane_holloway)
Assigned to: Nobody/Anonymous (nobody)
Summary: CTypes _as_parameter_ not working as documented

Initial Comment:
Reference: http://docs.python.org/dev/lib/ctypes-calling-functions-
with-own-custom-data-types.html

According to this document, I should be able to use my own objects with 
ctypes, provided I have an _as_parameter_ attribute set on my object.  
However, this does not work properly when the foreign function's 
argtypes have been set.  

This is because the _as_parameter_ access is not done until after the 
argument types are checked.  

Attached is a patch that adds _as_parameter_ checking to the types 
provided by _ctypes.c so that the feature works as documented for both 
typed and untyped foreign functions.
(Patch is against: svn rev 50859)


----------------------------------------------------------------------

>Comment By: Shane Holloway (shane_holloway)
Date: 2006-08-02 16:13

Message:
Logged In: YES 
user_id=283742

A related patch is http://python.org/sf/1532975 that simplifies the 
implementation of _as_parameter_

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1533481&group_id=5470


More information about the Python-bugs-list mailing list