Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

curses.filter can not be used as described in its documentation #46232

Closed
robinbryce mannequin opened this issue Jan 26, 2008 · 2 comments
Closed

curses.filter can not be used as described in its documentation #46232

robinbryce mannequin opened this issue Jan 26, 2008 · 2 comments
Labels
docs Documentation in the Doc dir stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error

Comments

@robinbryce
Copy link
Mannequin

robinbryce mannequin commented Jan 26, 2008

BPO 1940
Nosy @birkenfeld

Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

Show more details

GitHub fields:

assignee = None
closed_at = <Date 2008-01-26.14:04:35.516>
created_at = <Date 2008-01-26.12:56:45.799>
labels = ['type-bug', 'library', 'docs']
title = 'curses.filter can not be used as described in its documentation'
updated_at = <Date 2008-01-26.14:04:35.505>
user = 'https://bugs.python.org/robinbryce'

bugs.python.org fields:

activity = <Date 2008-01-26.14:04:35.505>
actor = 'georg.brandl'
assignee = 'none'
closed = True
closed_date = <Date 2008-01-26.14:04:35.516>
closer = 'georg.brandl'
components = ['Documentation', 'Library (Lib)']
creation = <Date 2008-01-26.12:56:45.799>
creator = 'robinbryce'
dependencies = []
files = []
hgrepos = []
issue_num = 1940
keywords = []
message_count = 2.0
messages = ['61708', '61709']
nosy_count = 2.0
nosy_names = ['georg.brandl', 'robinbryce']
pr_nums = []
priority = 'normal'
resolution = 'fixed'
stage = None
status = 'closed'
superseder = None
type = 'behavior'
url = 'https://bugs.python.org/issue1940'
versions = ['Python 2.5']

@robinbryce
Copy link
Mannequin Author

robinbryce mannequin commented Jan 26, 2008

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

@robinbryce robinbryce mannequin added docs Documentation in the Doc dir stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error labels Jan 26, 2008
@birkenfeld
Copy link
Member

You're right. I fixed this in r60322, r60323 (2.5).

@ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs Documentation in the Doc dir stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error
Projects
None yet
Development

No branches or pull requests

1 participant