diff options
author | Neal Norwitz <nnorwitz@gmail.com> | 2006-09-11 04:02:43 (GMT) |
---|---|---|
committer | Neal Norwitz <nnorwitz@gmail.com> | 2006-09-11 04:02:43 (GMT) |
commit | 5728c27c7401b0841d3c6c4a45c991a5608a2593 (patch) | |
tree | 4a28da8141baa5f099987ba242038a859be5c5df /Modules | |
parent | 71e2aa0cc5c07a4e15a48c35739f34d5ab69d26c (diff) | |
download | cpython-5728c27c7401b0841d3c6c4a45c991a5608a2593.zip cpython-5728c27c7401b0841d3c6c4a45c991a5608a2593.tar.gz cpython-5728c27c7401b0841d3c6c4a45c991a5608a2593.tar.bz2 |
Backport rev 51820 from Thomas Heller
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.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/Modules/_ctypes/_ctypes.c b/Modules/_ctypes/_ctypes.c index 5204a7f..4d57416 100644 --- a/Modules/_ctypes/_ctypes.c +++ b/Modules/_ctypes/_ctypes.c @@ -4590,11 +4590,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; |