summaryrefslogtreecommitdiff
path: root/Objects/fileobject.c
diff options
context:
space:
mode:
Diffstat (limited to 'Objects/fileobject.c')
-rw-r--r--Objects/fileobject.c13
1 files changed, 5 insertions, 8 deletions
diff --git a/Objects/fileobject.c b/Objects/fileobject.c
index f4424184d2..3c3d46da51 100644
--- a/Objects/fileobject.c
+++ b/Objects/fileobject.c
@@ -146,7 +146,7 @@ PyFile_WriteObject(PyObject *v, PyObject *f, int flags)
Py_DECREF(writer);
return -1;
}
- result = _PyObject_CallArg1(writer, value);
+ result = PyObject_CallFunctionObjArgs(writer, value, NULL);
Py_DECREF(value);
Py_DECREF(writer);
if (result == NULL)
@@ -367,7 +367,7 @@ stdprinter_write(PyStdPrinter_Object *self, PyObject *args)
{
PyObject *unicode;
PyObject *bytes = NULL;
- char *str;
+ const char *str;
Py_ssize_t n;
int err;
@@ -389,10 +389,8 @@ stdprinter_write(PyStdPrinter_Object *self, PyObject *args)
bytes = _PyUnicode_AsUTF8String(unicode, "backslashreplace");
if (bytes == NULL)
return NULL;
- if (PyBytes_AsStringAndSize(bytes, &str, &n) < 0) {
- Py_DECREF(bytes);
- return NULL;
- }
+ str = PyBytes_AS_STRING(bytes);
+ n = PyBytes_GET_SIZE(bytes);
}
n = _Py_write(self->fd, str, n);
@@ -458,8 +456,7 @@ static PyMethodDef stdprinter_methods[] = {
static PyObject *
get_closed(PyStdPrinter_Object *self, void *closure)
{
- Py_INCREF(Py_False);
- return Py_False;
+ Py_RETURN_FALSE;
}
static PyObject *