[Patches] [ python-Patches-1532975 ] Replace the ctypes internal '_as_parameter_' mechanism

SourceForge.net noreply at sourceforge.net
Thu Aug 3 10:51:05 CEST 2006


Patches item #1532975, was opened at 2006-08-02 09:57
Message generated for change (Comment added) made by theller
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1532975&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: Thomas Heller (theller)
Assigned to: Nobody/Anonymous (nobody)
Summary: Replace the ctypes internal '_as_parameter_' mechanism

Initial Comment:
This patch removes the '_as_parameter_' public
attribute of ctypes instances, and replaces the
mechanism by an internal one.

This mechanism is used to convert a ctypes instance to
an (internal) PyCArgObject instance which can directly
by used as an argument in a C function call.

With this patch, a C function pointer which does create
the PyCArgObject instance is stored in the type
dictionary (an StgDict instance).

This does speed up foreign function calls with one
ctypes argument by about 20%, but more important, it
will allow to fix the '_as_parameter_' mechanism, which
is documented in [1], so that it actually will work as
describes, even for functions that have 'argtypes' set.

[1] 
http://docs.python.org/dev/lib/ctypes-calling-functions-with-own-custom-data-types.html

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

>Comment By: Thomas Heller (theller)
Date: 2006-08-03 10:51

Message:
Logged In: YES 
user_id=11105

The previous patch was against the ctypes repository.  I've
deleted this patch and attached a new one against the Python
svn trunk.

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

Comment By: Shane Holloway (shane_holloway)
Date: 2006-08-03 00:15

Message:
Logged In: YES 
user_id=283742

This patch enables bug fix for the _as_parameter_ mechanism.  Please see 
http://python.org/sf/1533481.  

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

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


More information about the Patches mailing list