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.
........
This commit is contained in:
Mark Dickinson 2010-07-18 07:42:29 +00:00
parent 82a6bf049e
commit 101d16cb14
1 changed files with 2 additions and 2 deletions

View File

@ -856,11 +856,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;
} }