diff options
author | Guido van Rossum <guido@python.org> | 2007-11-21 20:17:11 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 2007-11-21 20:17:11 (GMT) |
commit | f9e443c49f682d36dc4a183f1ce5f6b32f84d80c (patch) | |
tree | b23553a3002b166cf55e71bfab7968ea95885de4 | |
parent | 82c0dfa3bdf59d32b44000686a89d2ecd5c8177d (diff) | |
download | cpython-f9e443c49f682d36dc4a183f1ce5f6b32f84d80c.zip cpython-f9e443c49f682d36dc4a183f1ce5f6b32f84d80c.tar.gz cpython-f9e443c49f682d36dc4a183f1ce5f6b32f84d80c.tar.bz2 |
Make os.read() return bytes, not bytearray.
-rw-r--r-- | Modules/posixmodule.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c index 27efcd3..658d159 100644 --- a/Modules/posixmodule.c +++ b/Modules/posixmodule.c @@ -4746,18 +4746,18 @@ posix_read(PyObject *self, PyObject *args) errno = EINVAL; return posix_error(); } - buffer = PyBytes_FromStringAndSize((char *)NULL, size); + buffer = PyString_FromStringAndSize((char *)NULL, size); if (buffer == NULL) return NULL; Py_BEGIN_ALLOW_THREADS - n = read(fd, PyBytes_AsString(buffer), size); + n = read(fd, PyString_AS_STRING(buffer), size); Py_END_ALLOW_THREADS if (n < 0) { Py_DECREF(buffer); return posix_error(); } if (n != size) - PyBytes_Resize(buffer, n); + _PyString_Resize(&buffer, n); return buffer; } |