[New-bugs-announce] [issue1940] curses.filter can not be used as described in its documentation

Robin Bryce report at bugs.python.org
Sat Jan 26 13:57:46 CET 2008


New submission from Robin Bryce:

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".

----------
components: Documentation, Library (Lib)
messages: 61708
nosy: robinbryce
severity: normal
status: open
title: curses.filter can not be used as described in its documentation
type: behavior
versions: Python 2.5

__________________________________
Tracker <report at bugs.python.org>
<http://bugs.python.org/issue1940>
__________________________________


More information about the New-bugs-announce mailing list