summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorBenjamin Peterson <benjamin@python.org>2010-07-07 19:03:36 (GMT)
committerBenjamin Peterson <benjamin@python.org>2010-07-07 19:03:36 (GMT)
commit489113fd5f2e8e967d7c297697f951ec97c8b715 (patch)
tree8030d03877cc4d1823444f7b57158ff9b98cb4db /Modules
parentba303c82d117d81101308ee241dab02cf8864169 (diff)
downloadcpython-489113fd5f2e8e967d7c297697f951ec97c8b715.zip
cpython-489113fd5f2e8e967d7c297697f951ec97c8b715.tar.gz
cpython-489113fd5f2e8e967d7c297697f951ec97c8b715.tar.bz2
Merged revisions 82628,82630 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k ........ r82628 | benjamin.peterson | 2010-07-07 13:44:05 -0500 (Wed, 07 Jul 2010) | 1 line this needn't be in the loop ........ r82630 | benjamin.peterson | 2010-07-07 13:54:59 -0500 (Wed, 07 Jul 2010) | 1 line don't ignore exceptions from PyObject_IsTrue ........
Diffstat (limited to 'Modules')
-rw-r--r--Modules/_struct.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/Modules/_struct.c b/Modules/_struct.c
index 2eb461f..52c5eeb 100644
--- a/Modules/_struct.c
+++ b/Modules/_struct.c
@@ -636,9 +636,13 @@ np_ulonglong(char *p, PyObject *v, const formatdef *f)
static int
np_bool(char *p, PyObject *v, const formatdef *f)
{
- BOOL_TYPE y;
+ int y;
+ BOOL_TYPE x;
y = PyObject_IsTrue(v);
- memcpy(p, (char *)&y, sizeof y);
+ if (y < 0)
+ return -1;
+ x = y;
+ memcpy(p, (char *)&x, sizeof x);
return 0;
}
@@ -910,6 +914,8 @@ bp_bool(char *p, PyObject *v, const formatdef *f)
{
char y;
y = PyObject_IsTrue(v);
+ if (y < 0)
+ return -1;
memcpy(p, (char *)&y, sizeof y);
return 0;
}