Skip to content

Commit 29604a1

Browse files
committed
python#1940: make it possible to use curses.filter() before curses.initscr()
as the documentation says.
1 parent 2a7d991 commit 29604a1

2 files changed

Lines changed: 14 additions & 1 deletion

File tree

Misc/NEWS

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1103,9 +1103,13 @@ Library
11031103
does not claim to support starttls. Adds the SMTP.ehlo_or_helo_if_needed()
11041104
method. Patch contributed by Bill Fenner.
11051105

1106+
11061107
Extension Modules
11071108
-----------------
11081109

1110+
- #1940: make it possible to use curses.filter() before curses.initscr()
1111+
as the documentation says.
1112+
11091113
- Backport of _fileio module from Python 3.0.
11101114

11111115
- #1087741: mmap.mmap is now a class, not a factory function. It is also

Modules/_cursesmodule.c

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1677,10 +1677,19 @@ NoArgTrueFalseFunction(has_colors)
16771677
NoArgTrueFalseFunction(has_ic)
16781678
NoArgTrueFalseFunction(has_il)
16791679
NoArgTrueFalseFunction(isendwin)
1680-
NoArgNoReturnVoidFunction(filter)
16811680
NoArgNoReturnVoidFunction(flushinp)
16821681
NoArgNoReturnVoidFunction(noqiflush)
16831682

1683+
static PyObject *
1684+
PyCurses_filter(PyObject *self)
1685+
{
1686+
/* not checking for PyCursesInitialised here since filter() must
1687+
be called before initscr() */
1688+
filter();
1689+
Py_INCREF(Py_None);
1690+
return Py_None;
1691+
}
1692+
16841693
static PyObject *
16851694
PyCurses_Color_Content(PyObject *self, PyObject *args)
16861695
{

0 commit comments

Comments
 (0)