[Python-checkins] r55680 - python/branches/cpy_merge/Modules/_bytes_iomodule.c

alexandre.vassalotti python-checkins at python.org
Wed May 30 21:16:56 CEST 2007


Author: alexandre.vassalotti
Date: Wed May 30 21:16:53 2007
New Revision: 55680

Modified:
   python/branches/cpy_merge/Modules/_bytes_iomodule.c
Log:
Minor cosmetic changes.


Modified: python/branches/cpy_merge/Modules/_bytes_iomodule.c
==============================================================================
--- python/branches/cpy_merge/Modules/_bytes_iomodule.c	(original)
+++ python/branches/cpy_merge/Modules/_bytes_iomodule.c	Wed May 30 21:16:53 2007
@@ -72,7 +72,7 @@
 
 		PyMem_Resize(self->buf, char, self->buf_size);
 		if (self->buf == NULL) {
-			PyErr_SetString(PyExc_MemoryError, "out of memory");
+			PyErr_SetString(PyExc_MemoryError, "Out of memory");
 			PyMem_Del(self->buf);
 			self->buf_size = self->pos = 0;
 			return -1;
@@ -99,6 +99,7 @@
 
 	if (self->buf == NULL)
 		result = Py_True;
+
 	Py_INCREF(result);
 	return result;
 }
@@ -131,10 +132,19 @@
 }
 
 static PyObject *
+bytes_io_tell(BytesIOObject *self)
+{
+	if (self->buf == NULL)
+		return err_closed();
+
+	return PyInt_FromSsize_t(self->pos);
+}
+
+static PyObject *
 bytes_io_read(BytesIOObject *self, PyObject *args)
 {
 	Py_ssize_t l, n = -1;
-	char *output = NULL;
+	char *output;
 
 	if (self->buf == NULL)
 		return err_closed();
@@ -182,10 +192,9 @@
 static PyObject *
 bytes_io_readlines(BytesIOObject *self, PyObject *args)
 {
-	int n;
-	char *output;
+	Py_ssize_t n, hint = 0, length = 0;
 	PyObject *result, *line;
-	int hint = 0, length = 0;
+	char *output;
 
 	if (self->buf == NULL)
 		return err_closed();
@@ -221,15 +230,6 @@
 }
 
 static PyObject *
-bytes_io_tell(BytesIOObject *self)
-{
-	if (self->buf == NULL)
-		return err_closed();
-
-	return PyInt_FromSsize_t(self->pos);
-}
-
-static PyObject *
 bytes_io_truncate(BytesIOObject *self, PyObject *args)
 {
 	Py_ssize_t size;
@@ -321,7 +321,7 @@
 bytes_io_write(BytesIOObject *self, PyObject *args)
 {
 	const char *c;
-	int l;
+	Py_ssize_t l;
 
 	if (self->buf == NULL)
 		return err_closed();
@@ -432,7 +432,7 @@
 
 
 PyDoc_STRVAR(BytesIO_doc,
-"BytesIO([s]) -> Return a BytesIO stream for reading and writing.");
+"BytesIO([buffer]) -> Return a BytesIO stream for reading and writing.");
 
 PyDoc_STRVAR(BytesIO_flush_doc,
 "flush() -> None.  Does nothing.");


More information about the Python-checkins mailing list