summaryrefslogtreecommitdiffstats
path: root/Modules/_ctypes
diff options
context:
space:
mode:
authorThomas Heller <theller@ctypes.org>2006-04-05 19:51:19 (GMT)
committerThomas Heller <theller@ctypes.org>2006-04-05 19:51:19 (GMT)
commit0890de3be0a8507fcabd8587f57656ed27bda45d (patch)
treeb33b8e86d06f3d56bee2c33e4bc53ed669eb7010 /Modules/_ctypes
parentfb8f83b33f23350c52aaec4d652d6becfda11d07 (diff)
downloadcpython-0890de3be0a8507fcabd8587f57656ed27bda45d.zip
cpython-0890de3be0a8507fcabd8587f57656ed27bda45d.tar.gz
cpython-0890de3be0a8507fcabd8587f57656ed27bda45d.tar.bz2
Explicitely use 'signed char', to avoid problems on platforms with unsigned char type.
Diffstat (limited to 'Modules/_ctypes')
-rw-r--r--Modules/_ctypes/cfield.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/Modules/_ctypes/cfield.c b/Modules/_ctypes/cfield.c
index f93f958..7bef412 100644
--- a/Modules/_ctypes/cfield.c
+++ b/Modules/_ctypes/cfield.c
@@ -499,7 +499,7 @@ b_set(void *ptr, PyObject *value, unsigned size)
long val;
if (get_long(value, &val) < 0)
return NULL;
- *(char *)ptr = (char)SET(*(char *)ptr, (char)val, size);
+ *(signed char *)ptr = (signed char)SET(*(signed char *)ptr, (signed char)val, size);
_RET(value);
}
@@ -507,7 +507,7 @@ b_set(void *ptr, PyObject *value, unsigned size)
static PyObject *
b_get(void *ptr, unsigned size)
{
- char val = *(char *)ptr;
+ signed char val = *(signed char *)ptr;
GET_BITFIELD(val, size);
return PyInt_FromLong(val);
}