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
........
This commit is contained in:
Benjamin Peterson 2010-07-07 19:03:36 +00:00
parent ba303c82d1
commit 489113fd5f
2 changed files with 16 additions and 4 deletions

View file

@ -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;
}