[Python-checkins] r82941 - python/branches/py3k/Modules/_struct.c

mark.dickinson python-checkins at python.org
Sun Jul 18 09:29:03 CEST 2010


Author: mark.dickinson
Date: Sun Jul 18 09:29:02 2010
New Revision: 82941

Log:
Issue #9277: Struct module: standard bool packing was incorrect if
char is unsigned.  Thanks Stefan Krah for the patch.


Modified:
   python/branches/py3k/Modules/_struct.c

Modified: python/branches/py3k/Modules/_struct.c
==============================================================================
--- python/branches/py3k/Modules/_struct.c	(original)
+++ python/branches/py3k/Modules/_struct.c	Sun Jul 18 09:29:02 2010
@@ -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;
 }
 


More information about the Python-checkins mailing list