summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorThomas Heller <theller@ctypes.org>2006-09-07 19:09:54 (GMT)
committerThomas Heller <theller@ctypes.org>2006-09-07 19:09:54 (GMT)
commit2244af596a56baaab3b85028189434f0c8a1d1e8 (patch)
tree7c0f04d85b4c6b14589d1decc8eb9be7d9ddb8b3 /Modules
parentfdb62f0e5f0b7d1a70a9d8948768ff09ea420c41 (diff)
downloadcpython-2244af596a56baaab3b85028189434f0c8a1d1e8.zip
cpython-2244af596a56baaab3b85028189434f0c8a1d1e8.tar.gz
cpython-2244af596a56baaab3b85028189434f0c8a1d1e8.tar.bz2
The cast function did not accept c_char_p or c_wchar_p instances
as first argument, and failed with a 'bad argument to internal function' error message.
Diffstat (limited to 'Modules')
-rw-r--r--Modules/_ctypes/_ctypes.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/Modules/_ctypes/_ctypes.c b/Modules/_ctypes/_ctypes.c
index 6234c2b..8889038 100644
--- a/Modules/_ctypes/_ctypes.c
+++ b/Modules/_ctypes/_ctypes.c
@@ -4597,11 +4597,11 @@ cast(void *ptr, PyObject *src, PyObject *ctype)
if (obj->b_objects == NULL)
goto failed;
}
+ Py_XINCREF(obj->b_objects);
result->b_objects = obj->b_objects;
- if (result->b_objects) {
+ if (result->b_objects && PyDict_Check(result->b_objects)) {
PyObject *index;
int rc;
- Py_INCREF(obj->b_objects);
index = PyLong_FromVoidPtr((void *)src);
if (index == NULL)
goto failed;