@@ -1189,25 +1189,6 @@ static char oct_doc[] =
11891189Return the octal representation of an integer or long integer." ;
11901190
11911191
1192- static PyObject *
1193- builtin_open (PyObject * self , PyObject * args )
1194- {
1195- return PyFile_Type .tp_new (& PyFile_Type , args , NULL );
1196- }
1197-
1198- /* XXX Keep this in synch with file_doc in fileobject.c. */
1199- static char open_doc [] =
1200- "open(name[, mode[, buffering]]) -> file object\n"
1201- "\n"
1202- "Open a file. The mode can be 'r', 'w' or 'a' for reading (default),\n"
1203- "writing or appending. The file will be created if it doesn't exist\n"
1204- "when opened for writing or appending; it will be truncated when\n"
1205- "opened for writing. Add a 'b' to the mode for binary files.\n"
1206- "Add a '+' to the mode to allow simultaneous reading and writing.\n"
1207- "If the buffering argument is given, 0 means unbuffered, 1 means line\n"
1208- "buffered, and larger numbers specify the buffer size." ;
1209-
1210-
12111192static PyObject *
12121193builtin_ord (PyObject * self , PyObject * obj )
12131194{
@@ -1802,7 +1783,6 @@ static PyMethodDef builtin_methods[] = {
18021783 {"max" , builtin_max , METH_VARARGS , max_doc },
18031784 {"min" , builtin_min , METH_VARARGS , min_doc },
18041785 {"oct" , builtin_oct , METH_O , oct_doc },
1805- {"open" , builtin_open , METH_VARARGS , open_doc },
18061786 {"ord" , builtin_ord , METH_O , ord_doc },
18071787 {"pow" , builtin_pow , METH_VARARGS , pow_doc },
18081788 {"range" , builtin_range , METH_VARARGS , range_doc },
@@ -1861,6 +1841,9 @@ _PyBuiltin_Init(void)
18611841 SETBUILTIN ("super" , & PySuper_Type );
18621842 SETBUILTIN ("tuple" , & PyTuple_Type );
18631843 SETBUILTIN ("type" , & PyType_Type );
1844+
1845+ /* Note that open() is just an alias of file(). */
1846+ SETBUILTIN ("open" , & PyFile_Type );
18641847 SETBUILTIN ("file" , & PyFile_Type );
18651848#ifdef Py_USING_UNICODE
18661849 SETBUILTIN ("unicode" , & PyUnicode_Type );
0 commit comments