classification
Title: curses.filter can not be used as described in its documentation
Type: behavior Stage:
Components: Documentation, Library (Lib) Versions: Python 2.5
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: georg.brandl, robinbryce
Priority: normal Keywords:

Created on 2008-01-26 12:56 by robinbryce, last changed 2008-01-26 14:04 by georg.brandl. This issue is now closed.

Messages (2)
msg61708 - (view) Author: Robin Bryce (robinbryce) Date: 2008-01-26 12:56
curses.filter forces the top most window to 1 line tall and preserves
existing tty content. It must be called *before* curses.initscr in order
to acheive this.

The python documentation states that curses.filter must be called before
initscr but the implementation prevents this. It uses the
NoArgNoReturnVoidFunction macro defined in Include/py_curses.h. This
macro in turn invokes the PyCursesInitialised macro which forces an
error if initscr has not been called.

curses.filter needs an explicit definition to avoid this:

Replacing "NoArgNoReturnVoidFunction(filter)" in Modules/_cursesmodule.c
with

static PyObject *PyCurses_filter (PyObject *self)
{
  /* MUST NOT BE PyCursesInitialised */
  filter(); \
  Py_INCREF(Py_None);
  return Py_None;
}

Would allow curses.filter to be called as documented. But really should
get a check for "!PyCursesInitialised".
msg61709 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2008-01-26 14:04
You're right. I fixed this in r60322, r60323 (2.5).
History
Date User Action Args
2008-01-26 14:04:35georg.brandlsetstatus: open -> closed
resolution: fixed
messages: + msg61709
nosy: + georg.brandl
2008-01-26 12:56:45robinbrycecreate