bpo-15999: Clean up of handling boolean arguments. (GH-15610)
* Use the 'p' format unit instead of manually called PyObject_IsTrue().
* Pass boolean value instead 0/1 integers to functions that needs boolean.
* Convert some arguments to boolean only once.
diff --git a/Modules/_io/stringio.c b/Modules/_io/stringio.c
index 3f7afad..89b29bb 100644
--- a/Modules/_io/stringio.c
+++ b/Modules/_io/stringio.c
@@ -714,9 +714,9 @@
}
if (self->readuniversal) {
- self->decoder = PyObject_CallFunction(
+ self->decoder = PyObject_CallFunctionObjArgs(
(PyObject *)&PyIncrementalNewlineDecoder_Type,
- "Oi", Py_None, (int) self->readtranslate);
+ Py_None, self->readtranslate ? Py_True : Py_False, NULL);
if (self->decoder == NULL)
return -1;
}