[Python-3000-checkins] r59099 - python/branches/py3k/Modules/posixmodule.c

guido.van.rossum python-3000-checkins at python.org
Wed Nov 21 21:17:12 CET 2007


Author: guido.van.rossum
Date: Wed Nov 21 21:17:11 2007
New Revision: 59099

Modified:
   python/branches/py3k/Modules/posixmodule.c
Log:
Make os.read() return bytes, not bytearray.


Modified: python/branches/py3k/Modules/posixmodule.c
==============================================================================
--- python/branches/py3k/Modules/posixmodule.c	(original)
+++ python/branches/py3k/Modules/posixmodule.c	Wed Nov 21 21:17:11 2007
@@ -4746,18 +4746,18 @@
 		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;
 }
 


More information about the Python-3000-checkins mailing list