]> granicus.if.org Git - python/commitdiff
Fixed a crash in ctypes, when HAVE_USABLE_WCHAR_T is false.
authorThomas Heller <theller@ctypes.org>
Thu, 8 Jan 2009 09:34:20 +0000 (09:34 +0000)
committerThomas Heller <theller@ctypes.org>
Thu, 8 Jan 2009 09:34:20 +0000 (09:34 +0000)
Fixes issue #4867.

Misc/NEWS
Modules/_ctypes/callproc.c

index bff99b9b2d82632fa392f023ac41323633cec8c1..f34cb916c016a1d58df97a2685a1866a4e7dfd56 100644 (file)
--- 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
index 0f9f511ef76c185324b0c9b1cd47a9d3dd1d3e38..bf0de88f7978aaeff27214692bb3cbd140416e6d 100644 (file)
@@ -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;