[Python-checkins] r69505 - in python/trunk: Misc/NEWS Modules/_ctypes/callproc.c

thomas.heller python-checkins at python.org
Tue Feb 10 19:43:01 CET 2009


Author: thomas.heller
Date: Tue Feb 10 19:43:01 2009
New Revision: 69505

Log:
Issue#5203: ctypes segfaults when passing a unicode string to a
function without argtypes, if HAVE_USABLE_WCHAR_T is false.


Modified:
   python/trunk/Misc/NEWS
   python/trunk/Modules/_ctypes/callproc.c

Modified: python/trunk/Misc/NEWS
==============================================================================
--- python/trunk/Misc/NEWS	(original)
+++ python/trunk/Misc/NEWS	Tue Feb 10 19:43:01 2009
@@ -152,6 +152,9 @@
 Library
 -------
 
+- Issue #5203: Fixed ctypes segfaults when passing a unicode string to a
+  function without argtypes (only occurs if HAVE_USABLE_WCHAR_T is false).
+
 - Issue #3386: distutils.sysconfig.get_python_lib prefix argument was ignored
   under NT and OS2. Patch by Philip Jenvey.
 

Modified: python/trunk/Modules/_ctypes/callproc.c
==============================================================================
--- python/trunk/Modules/_ctypes/callproc.c	(original)
+++ python/trunk/Modules/_ctypes/callproc.c	Tue Feb 10 19:43:01 2009
@@ -664,6 +664,7 @@
 		return 0;
 #else
 		int size = PyUnicode_GET_SIZE(obj);
+		pa->ffi_type = &ffi_type_pointer;
 		size += 1; /* terminating NUL */
 		size *= sizeof(wchar_t);
 		pa->value.p = PyMem_Malloc(size);


More information about the Python-checkins mailing list