This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Replace the ctypes internal '_as_parameter_' mechanism
Type: Stage:
Components: None Versions: Python 2.5
process
Status: closed Resolution: accepted
Dependencies: Superseder:
Assigned To: theller Nosy List: nnorwitz, shane_holloway, theller
Priority: normal Keywords: patch

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

Files
File name Uploaded Description Edit
as_parameter.patch theller, 2006-08-03 08:51 Patch against Python trunk
Messages (5)
msg50801 - (view) Author: Thomas Heller (theller) * (Python committer) Date: 2006-08-02 07:57
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
msg50802 - (view) Author: Shane Holloway (shane_holloway) Date: 2006-08-02 22:15
Logged In: YES 
user_id=283742

This patch enables bug fix for the _as_parameter_ mechanism.  Please see 
http://python.org/sf/1533481.  
msg50803 - (view) Author: Thomas Heller (theller) * (Python committer) Date: 2006-08-03 08:51
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.
msg50804 - (view) Author: Neal Norwitz (nnorwitz) * (Python committer) Date: 2006-08-12 05:54
Logged In: YES 
user_id=33168

Please check this in ASAP and remember to make an entry in
Misc/NEWS.  Also, PyObject_stgdict() can return NULL, but
the values aren't checked.  There may be a few other
unchecked returns.
msg50805 - (view) Author: Thomas Heller (theller) * (Python committer) Date: 2006-08-14 14:20
Logged In: YES 
user_id=11105

A variant of this patch together with the general idea of
the patch in #1533481 was committed as SVN rev. 51227.
History
Date User Action Args
2022-04-11 14:56:19adminsetgithub: 43759
2006-08-02 07:57:05thellercreate