summaryrefslogtreecommitdiffstats
path: root/Modules/_csv.c
diff options
context:
space:
mode:
authorAntoine Pitrou <solipsis@pitrou.net>2012-08-15 21:18:25 (GMT)
committerAntoine Pitrou <solipsis@pitrou.net>2012-08-15 21:18:25 (GMT)
commit6f430e496339aea3e688165340456b555d5e1035 (patch)
tree197393decf924def07e006f3e35cf21f2fec0f08 /Modules/_csv.c
parentdd7c55250d67de4d430a0c51dba4f3c0cd8f6ed3 (diff)
downloadcpython-6f430e496339aea3e688165340456b555d5e1035.zip
cpython-6f430e496339aea3e688165340456b555d5e1035.tar.gz
cpython-6f430e496339aea3e688165340456b555d5e1035.tar.bz2
Issue #15604: Update uses of PyObject_IsTrue() to check for and handle errors correctly.
Patch by Serhiy Storchaka.
Diffstat (limited to 'Modules/_csv.c')
-rw-r--r--Modules/_csv.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/Modules/_csv.c b/Modules/_csv.c
index a749cec..6c564d7 100644
--- a/Modules/_csv.c
+++ b/Modules/_csv.c
@@ -166,8 +166,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;
}