From: Thomas Heller Date: Thu, 8 Jan 2009 09:34:20 +0000 (+0000) Subject: Fixed a crash in ctypes, when HAVE_USABLE_WCHAR_T is false. X-Git-Tag: v3.1a1~562 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=5e4e4278c9ddec1d143962a53de653442a61f443;p=python Fixed a crash in ctypes, when HAVE_USABLE_WCHAR_T is false. Fixes issue #4867. --- diff --git a/Misc/NEWS b/Misc/NEWS index bff99b9b2d..f34cb916c0 100644 --- a/Misc/NEWS +++ b/Misc/NEWS @@ -88,6 +88,9 @@ Core and Builtins Library ------- +- Issue #4867: Fixed a crash in ctypes when passing a string to a + function without defining argtypes. + - Issue #4272: Add an optional argument to the GzipFile constructor to override the timestamp in the gzip stream. The default value remains the current time. The information can be used by e.g. gunzip when decompressing. Patch by diff --git a/Modules/_ctypes/callproc.c b/Modules/_ctypes/callproc.c index 0f9f511ef7..bf0de88f79 100644 --- a/Modules/_ctypes/callproc.c +++ b/Modules/_ctypes/callproc.c @@ -645,8 +645,8 @@ static int ConvParam(PyObject *obj, Py_ssize_t index, struct argument *pa) #ifdef CTYPES_UNICODE if (PyUnicode_Check(obj)) { -#ifdef HAVE_USABLE_WCHAR_T pa->ffi_type = &ffi_type_pointer; +#ifdef HAVE_USABLE_WCHAR_T pa->value.p = PyUnicode_AS_UNICODE(obj); Py_INCREF(obj); pa->keep = obj;