summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMark Dickinson <dickinsm@gmail.com>2010-07-18 07:42:29 (GMT)
committerMark Dickinson <dickinsm@gmail.com>2010-07-18 07:42:29 (GMT)
commit101d16cb14ea046893c4016c643daafa4605d3c7 (patch)
treec2835a245be50b5fee093b88bd0b381cb42002bc
parent82a6bf049e2ccceb99e9288440ffffad77bf9e90 (diff)
downloadcpython-101d16cb14ea046893c4016c643daafa4605d3c7.zip
cpython-101d16cb14ea046893c4016c643daafa4605d3c7.tar.gz
cpython-101d16cb14ea046893c4016c643daafa4605d3c7.tar.bz2
Merged revisions 82941 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k ........ r82941 | mark.dickinson | 2010-07-18 08:29:02 +0100 (Sun, 18 Jul 2010) | 3 lines Issue #9277: Struct module: standard bool packing was incorrect if char is unsigned. Thanks Stefan Krah for the patch. ........
-rw-r--r--Modules/_struct.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/Modules/_struct.c b/Modules/_struct.c
index ba8a8ed..c1db286 100644
--- a/Modules/_struct.c
+++ b/Modules/_struct.c
@@ -856,11 +856,11 @@ bp_double(char *p, PyObject *v, const formatdef *f)
static int
bp_bool(char *p, PyObject *v, const formatdef *f)
{
- char y;
+ int y;
y = PyObject_IsTrue(v);
if (y < 0)
return -1;
- memcpy(p, (char *)&y, sizeof y);
+ *p = (char)y;
return 0;
}