mirror of
https://github.com/python/cpython.git
synced 2025-09-27 10:50:04 +00:00
Explicitely use 'signed char', to avoid problems on platforms with unsigned char type.
This commit is contained in:
parent
fb8f83b33f
commit
0890de3be0
1 changed files with 2 additions and 2 deletions
|
@ -499,7 +499,7 @@ b_set(void *ptr, PyObject *value, unsigned size)
|
||||||
long val;
|
long val;
|
||||||
if (get_long(value, &val) < 0)
|
if (get_long(value, &val) < 0)
|
||||||
return NULL;
|
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);
|
_RET(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -507,7 +507,7 @@ b_set(void *ptr, PyObject *value, unsigned size)
|
||||||
static PyObject *
|
static PyObject *
|
||||||
b_get(void *ptr, unsigned size)
|
b_get(void *ptr, unsigned size)
|
||||||
{
|
{
|
||||||
char val = *(char *)ptr;
|
signed char val = *(signed char *)ptr;
|
||||||
GET_BITFIELD(val, size);
|
GET_BITFIELD(val, size);
|
||||||
return PyInt_FromLong(val);
|
return PyInt_FromLong(val);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue