summaryrefslogtreecommitdiff
path: root/Modules/_struct.c
diff options
context:
space:
mode:
authorMark Dickinson <dickinsm@gmail.com>2010-07-18 07:29:02 +0000
committerMark Dickinson <dickinsm@gmail.com>2010-07-18 07:29:02 +0000
commiteff5d8594b817e5e101cf22b1af901d89363f70a (patch)
treef9cecf64475b4b1e628fb926310d3afb1f411e8d /Modules/_struct.c
parentd92f04062a8cb3c01ac44f67f7bde8a11b285457 (diff)
downloadcpython-git-eff5d8594b817e5e101cf22b1af901d89363f70a.tar.gz
Issue #9277: Struct module: standard bool packing was incorrect if
char is unsigned. Thanks Stefan Krah for the patch.
Diffstat (limited to 'Modules/_struct.c')
-rw-r--r--Modules/_struct.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/Modules/_struct.c b/Modules/_struct.c
index b5f18a96ad..d55ce0f60d 100644
--- a/Modules/_struct.c
+++ b/Modules/_struct.c
@@ -867,11 +867,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;
}