mirror of
https://github.com/python/cpython.git
synced 2025-12-04 00:30:19 +00:00
Issue #15604: Update uses of PyObject_IsTrue() to check for and handle errors correctly.
Patch by Serhiy Storchaka.
This commit is contained in:
commit
721738fbee
10 changed files with 76 additions and 74 deletions
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue