mirror of
https://github.com/python/cpython.git
synced 2025-08-01 15:43:13 +00:00
#2353: raise Py3k warning in file.xreadlines().
This commit is contained in:
parent
c76ffca2be
commit
a9916b55de
3 changed files with 21 additions and 3 deletions
|
@ -1735,6 +1735,15 @@ file_self(PyFileObject *f)
|
|||
return (PyObject *)f;
|
||||
}
|
||||
|
||||
static PyObject *
|
||||
file_xreadlines(PyFileObject *f)
|
||||
{
|
||||
if (PyErr_WarnPy3k("f.xreadlines() not supported in 3.x, "
|
||||
"try 'for line in f' instead", 1) < 0)
|
||||
return NULL;
|
||||
return file_self(f);
|
||||
}
|
||||
|
||||
static PyObject *
|
||||
file_exit(PyObject *f, PyObject *args)
|
||||
{
|
||||
|
@ -1850,9 +1859,9 @@ static PyMethodDef file_methods[] = {
|
|||
#endif
|
||||
{"tell", (PyCFunction)file_tell, METH_NOARGS, tell_doc},
|
||||
{"readinto", (PyCFunction)file_readinto, METH_VARARGS, readinto_doc},
|
||||
{"readlines", (PyCFunction)file_readlines,METH_VARARGS, readlines_doc},
|
||||
{"xreadlines",(PyCFunction)file_self, METH_NOARGS, xreadlines_doc},
|
||||
{"writelines",(PyCFunction)file_writelines, METH_O, writelines_doc},
|
||||
{"readlines", (PyCFunction)file_readlines, METH_VARARGS, readlines_doc},
|
||||
{"xreadlines",(PyCFunction)file_xreadlines, METH_NOARGS, xreadlines_doc},
|
||||
{"writelines",(PyCFunction)file_writelines, METH_O, writelines_doc},
|
||||
{"flush", (PyCFunction)file_flush, METH_NOARGS, flush_doc},
|
||||
{"close", (PyCFunction)file_close, METH_NOARGS, close_doc},
|
||||
{"isatty", (PyCFunction)file_isatty, METH_NOARGS, isatty_doc},
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue