commit | eff5d8594b817e5e101cf22b1af901d89363f70a | [log] [tgz] |
---|---|---|
author | Mark Dickinson <dickinsm@gmail.com> | Sun Jul 18 07:29:02 2010 +0000 |
committer | Mark Dickinson <dickinsm@gmail.com> | Sun Jul 18 07:29:02 2010 +0000 |
tree | f9cecf64475b4b1e628fb926310d3afb1f411e8d | |
parent | d92f04062a8cb3c01ac44f67f7bde8a11b285457 [diff] |
Issue #9277: Struct module: standard bool packing was incorrect if char is unsigned. Thanks Stefan Krah for the patch.
diff --git a/Modules/_struct.c b/Modules/_struct.c index b5f18a9..d55ce0f 100644 --- a/Modules/_struct.c +++ b/Modules/_struct.c
@@ -867,11 +867,11 @@ 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; }