mirror of
https://github.com/python/cpython.git
synced 2025-09-27 02:39:58 +00:00
Issue #9277: Struct module: standard bool packing was incorrect if
char is unsigned. Thanks Stefan Krah for the patch.
This commit is contained in:
parent
d92f04062a
commit
eff5d8594b
1 changed files with 2 additions and 2 deletions
|
@ -867,11 +867,11 @@ bp_double(char *p, PyObject *v, const formatdef *f)
|
||||||
static int
|
static int
|
||||||
bp_bool(char *p, PyObject *v, const formatdef *f)
|
bp_bool(char *p, PyObject *v, const formatdef *f)
|
||||||
{
|
{
|
||||||
char y;
|
int y;
|
||||||
y = PyObject_IsTrue(v);
|
y = PyObject_IsTrue(v);
|
||||||
if (y < 0)
|
if (y < 0)
|
||||||
return -1;
|
return -1;
|
||||||
memcpy(p, (char *)&y, sizeof y);
|
*p = (char)y;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue