From: Georg Brandl Date: Sat, 26 Jan 2008 14:03:47 +0000 (+0000) Subject: #1940: make it possible to use curses.filter() before curses.initscr() X-Git-Tag: v2.6a1~390 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=29604a1b4c09ae6efc47fa0f34412168a34aa7dd;p=python #1940: make it possible to use curses.filter() before curses.initscr() as the documentation says. --- diff --git a/Misc/NEWS b/Misc/NEWS index d88303881e..16034183e4 100644 --- a/Misc/NEWS +++ b/Misc/NEWS @@ -1103,9 +1103,13 @@ Library does not claim to support starttls. Adds the SMTP.ehlo_or_helo_if_needed() method. Patch contributed by Bill Fenner. + Extension Modules ----------------- +- #1940: make it possible to use curses.filter() before curses.initscr() + as the documentation says. + - Backport of _fileio module from Python 3.0. - #1087741: mmap.mmap is now a class, not a factory function. It is also diff --git a/Modules/_cursesmodule.c b/Modules/_cursesmodule.c index 246e8717da..137c580731 100644 --- a/Modules/_cursesmodule.c +++ b/Modules/_cursesmodule.c @@ -1677,10 +1677,19 @@ NoArgTrueFalseFunction(has_colors) NoArgTrueFalseFunction(has_ic) NoArgTrueFalseFunction(has_il) NoArgTrueFalseFunction(isendwin) -NoArgNoReturnVoidFunction(filter) NoArgNoReturnVoidFunction(flushinp) NoArgNoReturnVoidFunction(noqiflush) +static PyObject * +PyCurses_filter(PyObject *self) +{ + /* not checking for PyCursesInitialised here since filter() must + be called before initscr() */ + filter(); + Py_INCREF(Py_None); + return Py_None; +} + static PyObject * PyCurses_Color_Content(PyObject *self, PyObject *args) {