1. python_mirrors
  2. sandbox/guido

Commits

Guido van Rossum  committed 9cfbc9b Draft

Reordered list of methods to hopefully put the most frequently used
ones near the front.

Also added a missing "return -1" to PyFile_WriteString.

  • Participants
  • Parent commits b83ecf6
  • Branches legacy-trunk

Comments (0)

Files changed (1)

File Objects/fileobject.c

View file
 }
 
 static PyMethodDef file_methods[] = {
-	{"close",	(PyCFunction)file_close, 0},
-	{"flush",	(PyCFunction)file_flush, 0},
+	{"readline",	(PyCFunction)file_readline, 1},
+	{"read",	(PyCFunction)file_read, 1},
+	{"write",	(PyCFunction)file_write, 0},
 	{"fileno",	(PyCFunction)file_fileno, 0},
-	{"isatty",	(PyCFunction)file_isatty, 0},
-	{"read",	(PyCFunction)file_read, 1},
-	{"readline",	(PyCFunction)file_readline, 1},
-	{"readlines",	(PyCFunction)file_readlines, 1},
 	{"seek",	(PyCFunction)file_seek, 0},
 #ifdef HAVE_FTRUNCATE
 	{"truncate",	(PyCFunction)file_truncate, 0},
 #endif
 	{"tell",	(PyCFunction)file_tell, 0},
-	{"write",	(PyCFunction)file_write, 0},
+	{"readinto",	(PyCFunction)file_readinto, 0},
+	{"readlines",	(PyCFunction)file_readlines, 1},
 	{"writelines",	(PyCFunction)file_writelines, 0},
-	{"readinto",	(PyCFunction)file_readinto, 0},
+	{"flush",	(PyCFunction)file_flush, 0},
+	{"close",	(PyCFunction)file_close, 0},
+	{"isatty",	(PyCFunction)file_isatty, 0},
 	{NULL,		NULL}		/* sentinel */
 };
 
 		Py_DECREF(v);
 		return err;
 	}
+	else
+		return -1;
 }