summaryrefslogtreecommitdiffstats
path: root/Modules/parsermodule.c
diff options
context:
space:
mode:
Diffstat (limited to 'Modules/parsermodule.c')
-rw-r--r--Modules/parsermodule.c18
1 files changed, 13 insertions, 5 deletions
diff --git a/Modules/parsermodule.c b/Modules/parsermodule.c
index 84516ec..b8732dc 100644
--- a/Modules/parsermodule.c
+++ b/Modules/parsermodule.c
@@ -401,10 +401,14 @@ parser_st2tuple(PyST_Object *self, PyObject *args, PyObject *kw)
int lineno = 0;
int col_offset = 0;
if (line_option != NULL) {
- lineno = (PyObject_IsTrue(line_option) != 0) ? 1 : 0;
+ lineno = PyObject_IsTrue(line_option);
+ if (lineno < 0)
+ return NULL;
}
if (col_option != NULL) {
- col_offset = (PyObject_IsTrue(col_option) != 0) ? 1 : 0;
+ col_offset = PyObject_IsTrue(col_option);
+ if (col_offset < 0)
+ return NULL;
}
/*
* Convert ST into a tuple representation. Use Guido's function,
@@ -444,10 +448,14 @@ parser_st2list(PyST_Object *self, PyObject *args, PyObject *kw)
int lineno = 0;
int col_offset = 0;
if (line_option != 0) {
- lineno = PyObject_IsTrue(line_option) ? 1 : 0;
+ lineno = PyObject_IsTrue(line_option);
+ if (lineno < 0)
+ return NULL;
}
- if (col_option != NULL) {
- col_offset = (PyObject_IsTrue(col_option) != 0) ? 1 : 0;
+ if (col_option != 0) {
+ col_offset = PyObject_IsTrue(col_option);
+ if (col_offset < 0)
+ return NULL;
}
/*
* Convert ST into a tuple representation. Use Guido's function,