From ee50e3c73472bfe70cdfa66db5ca21d154173be6 Mon Sep 17 00:00:00 2001 From: Georg Brandl Date: Sat, 26 Jan 2008 14:03:51 +0000 Subject: [PATCH] #1940: make it possible to use curses.filter() before curses.initscr() as the documentation says. (backport from rev. 60322) --- Misc/NEWS | 3 +++ Modules/_cursesmodule.c | 11 ++++++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/Misc/NEWS b/Misc/NEWS index 4913c79bcb7..f892f4d1afc 100644 --- a/Misc/NEWS +++ b/Misc/NEWS @@ -212,6 +212,9 @@ Library Extension Modules ----------------- +- #1940: make it possible to use curses.filter() before curses.initscr() + as the documentation says. + - Fix a potential 'SystemError: NULL result without error' in _ctypes. - Prevent a segfault when a ctypes NULL function pointer is called. diff --git a/Modules/_cursesmodule.c b/Modules/_cursesmodule.c index 1f6a426346d..12b496f8ad4 100644 --- a/Modules/_cursesmodule.c +++ b/Modules/_cursesmodule.c @@ -1619,10 +1619,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) {