mirror of
https://github.com/python/cpython.git
synced 2025-09-26 10:19:53 +00:00
Issue#5203: ctypes segfaults when passing a unicode string to a
function without argtypes, if HAVE_USABLE_WCHAR_T is false.
This commit is contained in:
parent
d155bbfbb2
commit
3689ae256e
2 changed files with 4 additions and 0 deletions
|
@ -664,6 +664,7 @@ static int ConvParam(PyObject *obj, Py_ssize_t index, struct argument *pa)
|
|||
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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue