Issue 1533481: CTypes as_parameter not working as documented (original) (raw)

Issue1533481

Created on 2006-08-02 22:11 by shane_holloway, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
from_param.patch shane_holloway,2006-08-02 22:11 Patch implementing _as_parameter_ as documented
Messages (3)
msg29429 - (view) Author: Shane Holloway (shane_holloway) Date: 2006-08-02 22:11
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)
msg29430 - (view) Author: Shane Holloway (shane_holloway) Date: 2006-08-02 22:13
Logged In: YES user_id=283742 A related patch is http://python.org/sf/1532975 that simplifies the implementation of _as_parameter_
msg29431 - (view) Author: Thomas Heller (theller) * (Python committer) Date: 2006-08-14 14:21
Logged In: YES user_id=11105 The patch in http://python.org/sf/1532975 was committed together with the general idea of this patch as SVN revision 51277.
History
Date User Action Args
2022-04-11 14:56:19 admin set github: 43763
2006-08-02 22:11:49 shane_holloway create