Message81544
| Author |
amaury.forgeotdarc |
| Recipients |
amaury.forgeotdarc, theller |
| Date |
2009年02月10日.12:48:02 |
| SpamBayes Score |
3.7931839e-06 |
| Marked as misclassified |
No |
| Message-id |
<1234270084.65.0.170774259742.issue5203@psf.upfronthosting.co.za> |
| In-reply-to |
| Content |
The following code segfaults on platforms where HAVE_USABLE_WCHAR_T is
not defined (for example: narrow unicode build and sizeof(wchar_t)==4)
>>> from ctypes import *
>>> import ctypes.util
>>> CDLL(ctypes.util.find_library('c')).wcslen(u'text')
(it works if the argtypes member is defined)
The reason is a non initialized structure, and the correction is trivial:
--- Modules/_ctypes/callproc.c~ 2007年06月15日 19:10:41.000000000 +0200
+++ Modules/_ctypes/callproc.c 2009年02月10日 13:28:10.000000000 +0100
@@ -538,6 +538,7 @@
int size = PyUnicode_GET_SIZE(obj);
size += 1; /* terminating NUL */
size *= sizeof(wchar_t);
+ pa->ffi_type = &ffi_type_pointer;
pa->value.p = PyMem_Malloc(size);
if (!pa->value.p) {
PyErr_NoMemory(); |
|
History
|
|---|
| Date |
User |
Action |
Args |
| 2009年02月10日 12:48:05 | amaury.forgeotdarc | set | recipients:
+ amaury.forgeotdarc, theller |
| 2009年02月10日 12:48:04 | amaury.forgeotdarc | set | messageid: <1234270084.65.0.170774259742.issue5203@psf.upfronthosting.co.za> |
| 2009年02月10日 12:48:03 | amaury.forgeotdarc | link | issue5203 messages |
| 2009年02月10日 12:48:02 | amaury.forgeotdarc | create |
|