[Patches] [ python-Patches-633635 ] Too much chtype in _cursesmodule.c

noreply@sourceforge.net noreply@sourceforge.net
Tue, 05 Nov 2002 05:25:40 -0800


Patches item #633635, was opened at 2002-11-05 00:07
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=633635&group_id=5470

Category: Modules
Group: None
Status: Open
>Resolution: Accepted
Priority: 5
Submitted By: David M. Cooke (dmcooke)
Assigned to: A.M. Kuchling (akuchling)
Summary: Too much chtype in _cursesmodule.c

Initial Comment:
The C prototype for getch is 'int getch(void)', not
'chtype getch(void)', as assumed by _cursesmodule.c
(the same for ungetch and keyname). [I've checked this
under Linux, SunOS, and Tru64]

keyname() seems to segfault if passed -1, so I've
tested for that.

In addition, according to the docs, the .getch() and
.getkey() methods of a window object should throw an
exception when there isn't any input in nodelay mode
(the C functions return ERR (== -1) in this case). I've
fixed getkey, but not getch, in this patch: since getch
returns an int anyways, it seems better to return -1 on
no input.


----------------------------------------------------------------------

>Comment By: A.M. Kuchling (akuchling)
Date: 2002-11-05 08:25

Message:
Logged In: YES 
user_id=11375

The patch looks OK.  One thing: the patch makes keyname() return an empty string if the character is -1.  My gut feeling is that an exception is better, because -1 really isn't a legal key code.  What do you think?

Once we've resolved that issue, I'll check in the patch.



----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=633635&group_id=5470