[Python-checkins] CVS: python/dist/src/Python bltinmodule.c,2.238,2.239
Tim Peters
tim_one@users.sourceforge.net
Thu, 13 Sep 2001 14:49:46 -0700
Update of /cvsroot/python/python/dist/src/Python
In directory usw-pr-cvs1:/tmp/cvs-serv14630/python/Python
Modified Files:
bltinmodule.c
Log Message:
Get rid of builtin_open() entirely (the C code and docstring, not the
builtin function); Guido pointed out that it could be just another
name in the __builtin__ dict for the file constructor now.
Index: bltinmodule.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Python/bltinmodule.c,v
retrieving revision 2.238
retrieving revision 2.239
diff -C2 -d -r2.238 -r2.239
*** bltinmodule.c 2001/09/13 21:37:17 2.238
--- bltinmodule.c 2001/09/13 21:49:44 2.239
***************
*** 1191,1213 ****
static PyObject *
- builtin_open(PyObject *self, PyObject *args)
- {
- return PyFile_Type.tp_new(&PyFile_Type, args, NULL);
- }
-
- /* XXX Keep this in synch with file_doc in fileobject.c. */
- static char open_doc[] =
- "open(name[, mode[, buffering]]) -> file object\n"
- "\n"
- "Open a file. The mode can be 'r', 'w' or 'a' for reading (default),\n"
- "writing or appending. The file will be created if it doesn't exist\n"
- "when opened for writing or appending; it will be truncated when\n"
- "opened for writing. Add a 'b' to the mode for binary files.\n"
- "Add a '+' to the mode to allow simultaneous reading and writing.\n"
- "If the buffering argument is given, 0 means unbuffered, 1 means line\n"
- "buffered, and larger numbers specify the buffer size.";
-
-
- static PyObject *
builtin_ord(PyObject *self, PyObject* obj)
{
--- 1191,1194 ----
***************
*** 1803,1807 ****
{"min", builtin_min, METH_VARARGS, min_doc},
{"oct", builtin_oct, METH_O, oct_doc},
- {"open", builtin_open, METH_VARARGS, open_doc},
{"ord", builtin_ord, METH_O, ord_doc},
{"pow", builtin_pow, METH_VARARGS, pow_doc},
--- 1784,1787 ----
***************
*** 1862,1865 ****
--- 1842,1848 ----
SETBUILTIN("tuple", &PyTuple_Type);
SETBUILTIN("type", &PyType_Type);
+
+ /* Note that open() is just an alias of file(). */
+ SETBUILTIN("open", &PyFile_Type);
SETBUILTIN("file", &PyFile_Type);
#ifdef Py_USING_UNICODE