]> granicus.if.org Git - python/commitdiff
#1940: make it possible to use curses.filter() before curses.initscr()
authorGeorg Brandl <georg@python.org>
Sat, 26 Jan 2008 14:03:51 +0000 (14:03 +0000)
committerGeorg Brandl <georg@python.org>
Sat, 26 Jan 2008 14:03:51 +0000 (14:03 +0000)
as the documentation says.
 (backport from rev. 60322)

Misc/NEWS
Modules/_cursesmodule.c

index 4913c79bcb7e2199d1c99c678717b1643e3ddbd6..f892f4d1afc81ad7116dcb90f0a5c0e87a1e9374 100644 (file)
--- 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.
index 1f6a426346d643028d8eaa6b87df87fd9b05253a..12b496f8ad4ee44b4663ba0e86d3a2459b11dd29 100644 (file)
@@ -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)
 {