Mercurial > cpython-lru_cache-weakref
diff Modules/_cursesmodule.c @ 42071:825041fc8e2c
Rip out the file object's implementation.
Fixed test_import.py while I was at it.
However, there's still a problem in import.c -- get_file() can leak a
FILE struct (not a file descriptor though). I'm not sure how to fix
this; closing the FILE* closes the file descriptor, and that's the
wrong thing to do when there's still a Python file object keeping the
file descriptor open. I also would rather not mess with dup(), as it
won't port to Windows.
| author | Guido van Rossum <guido@python.org> |
|---|---|
| date | Tue, 12 Jun 2007 23:30:11 +0000 |
| parents | 24b60622b944 |
| children | ffb1ae7233a2 |
line wrap: on
line diff
--- a/Modules/_cursesmodule.c Tue Jun 12 18:07:38 2007 +0000 +++ b/Modules/_cursesmodule.c Tue Jun 12 23:30:11 2007 +0000 @@ -1287,12 +1287,13 @@ if (!PyArg_ParseTuple(args, "O;fileobj", &temp)) return NULL; - if (!PyFile_Check(temp)) { - PyErr_SetString(PyExc_TypeError, "argument must be a file object"); - return NULL; - } + PyErr_SetString(PyExc_TypeError, "argument must be a file object"); + return NULL; + +#if 0 return PyCursesCheckERR(putwin(self->win, PyFile_AsFile(temp)), "putwin"); +#endif } static PyObject * @@ -1748,11 +1749,10 @@ PyCursesInitialised - if (!PyFile_Check(temp)) { - PyErr_SetString(PyExc_TypeError, "argument must be a file object"); - return NULL; - } - + PyErr_SetString(PyExc_TypeError, "argument must be a file object"); + return NULL; + +#if 0 win = getwin(PyFile_AsFile(temp)); if (win == NULL) { @@ -1761,6 +1761,7 @@ } return PyCursesWindow_New(win); +#endif } static PyObject *
