Issue #15604: Update uses of PyObject_IsTrue() to check for and handle errors correctly.

Patch by Serhiy Storchaka.
This commit is contained in:
Antoine Pitrou 2012-08-15 23:20:39 +02:00
commit 721738fbee
10 changed files with 76 additions and 74 deletions

View file

@ -196,8 +196,12 @@ _set_bool(const char *name, int *target, PyObject *src, int dflt)
{
if (src == NULL)
*target = dflt;
else
*target = PyObject_IsTrue(src);
else {
int b = PyObject_IsTrue(src);
if (b < 0)
return -1;
*target = b;
}
return 0;
}