summaryrefslogtreecommitdiffstats
path: root/Objects/fileobject.c
diff options
context:
space:
mode:
Diffstat (limited to 'Objects/fileobject.c')
-rw-r--r--Objects/fileobject.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/Objects/fileobject.c b/Objects/fileobject.c
index c5e0961..5594058 100644
--- a/Objects/fileobject.c
+++ b/Objects/fileobject.c
@@ -1941,13 +1941,13 @@ file_writelines(PyFileObject *f, PyObject *seq)
PyObject *v = PyList_GET_ITEM(list, i);
if (!PyString_Check(v)) {
const char *buffer;
- if (((f->f_binary &&
- PyObject_AsReadBuffer(v,
- (const void**)&buffer,
- &len)) ||
- PyObject_AsCharBuffer(v,
- &buffer,
- &len))) {
+ int res;
+ if (f->f_binary) {
+ res = PyObject_AsReadBuffer(v, (const void**)&buffer, &len);
+ } else {
+ res = PyObject_AsCharBuffer(v, &buffer, &len);
+ }
+ if (res) {
PyErr_SetString(PyExc_TypeError,
"writelines() argument must be a sequence of strings");
goto error;