summaryrefslogtreecommitdiff
path: root/Objects/fileobject.c
diff options
context:
space:
mode:
authorRaymond Hettinger <python@rcn.com>2017-02-06 07:15:57 -0800
committerRaymond Hettinger <python@rcn.com>2017-02-06 07:15:57 -0800
commit826745ba953b4ef23462fb0bc2d7b3db23b51d89 (patch)
tree7789cc87df07c2786c40e6888cbb532a94ce6334 /Objects/fileobject.c
parent95b272b4e0d5438a12702e51e05d03f5a5a8e505 (diff)
parent515f1cf20f4e9656b1bcda236bad8ed0e33770f0 (diff)
downloadcpython-826745ba953b4ef23462fb0bc2d7b3db23b51d89.tar.gz
merge
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 *