diff options
Diffstat (limited to 'Objects/fileobject.c')
| -rw-r--r-- | Objects/fileobject.c | 10 | 
1 files changed, 4 insertions, 6 deletions
diff --git a/Objects/fileobject.c b/Objects/fileobject.c index f4424184d2..fcdb5fd0a4 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);  | 
