Hi all,
I ran across this issue several months ago and filed a bug report
(#9667). It just came up again, and it doesn't look like anything's
been done with the bug report, so I thought I'd post here.
In _cursesmodule.c there are a lot of preprocesser conditionals that
test if the system is NetBSD. In my case, the issue was that the module
built lacked the KEY_UP / _DOWN / etc. constants, but there are other
changes as well. This is the case even if you're compiling against
ncurses instead of the system curses. Αttached below is a patch against
2.7.1 that negates the NetBSD conditionals if ncurses is present. It
seems to work as expected, although I haven't done any real testing. I
assumed this was done because NetBSD curses was missing something, but I
looked at the headers and it seems to have most of the constants that
the compilation directives are leaving out (A_INVIS, the aforementioned
KEY_* constants, at least), so I'm not sure why that code isn't compiled
in anyway. Please let me know if I'm misunderstanding this.
Thanks,
Bill
--- Python-2.7.1/Modules/_cursesmodule.c 2011-03-13 23:34:27.000000000
-0700
+++ Python-2.7.1/Modules/_cursesmodule.c.1 2011-03-14 00:33:09.000000000
-0700
@@ -322,13 +322,13 @@
Window_OneArgNoReturnFunction(clearok, int, "i;True(1) or False(0)")
Window_OneArgNoReturnFunction(idlok, int, "i;True(1) or False(0)")
-#if defined(__NetBSD__)
+#if defined(__NetBSD__) && !defined(HAVE_NCURSES_H)
Window_OneArgNoReturnVoidFunction(keypad, int, "i;True(1) or False(0)")
#else
Window_OneArgNoReturnFunction(keypad, int, "i;True(1) or False(0)")
#endif
Window_OneArgNoReturnFunction(leaveok, int, "i;True(1) or False(0)")
-#if defined(__NetBSD__)
+#if defined(__NetBSD__) && !defined(HAVE_NCURSES_H)
Window_OneArgNoReturnVoidFunction(nodelay, int, "i;True(1) or False(0)")
#else
Window_OneArgNoReturnFunction(nodelay, int, "i;True(1) or False(0)")
@@ -891,7 +891,7 @@
return Py_BuildValue("c", rtn);
} else {
const char *knp;
-#if defined(__NetBSD__)
+#if defined(__NetBSD__) && !defined(HAVE_NCURSES_H)
knp = unctrl(rtn);
#else
knp = keyname(rtn);
@@ -2108,7 +2108,7 @@
}
#endif /* HAVE_CURSES_IS_TERM_RESIZED */
-#if !defined(__NetBSD__)
+#if !defined(__NetBSD__) || defined(HAVE_NCURSES_H)
static PyObject *
PyCurses_KeyName(PyObject *self, PyObject *args)
{
@@ -2672,7 +2672,7 @@
#ifdef HAVE_CURSES_IS_TERM_RESIZED
{"is_term_resized", (PyCFunction)PyCurses_Is_Term_Resized,
METH_VARARGS},
#endif
-#if !defined(__NetBSD__)
+#if !defined(__NetBSD__) || defined(HAVE_NCURSES_H)
{"keyname", (PyCFunction)PyCurses_KeyName, METH_VARARGS},
#endif
{"killchar", (PyCFunction)PyCurses_KillChar, METH_NOARGS},
@@ -2783,7 +2783,7 @@
SetDictInt("A_DIM", A_DIM);
SetDictInt("A_BOLD", A_BOLD);
SetDictInt("A_ALTCHARSET", A_ALTCHARSET);
-#if !defined(__NetBSD__)
+#if !defined(__NetBSD__) || defined(HAVE_NCURSES_H)
SetDictInt("A_INVIS", A_INVIS);
#endif
SetDictInt("A_PROTECT", A_PROTECT);
@@ -2857,7 +2857,7 @@
int key;
char *key_n;
char *key_n2;
-#if !defined(__NetBSD__)
+#if !defined(__NetBSD__) || defined(HAVE_NCURSES_H)
for (key=KEY_MIN;key < KEY_MAX; key++) {
key_n = (char *)keyname(key);
if (key_n == NULL || strcmp(key_n,"UNKNOWN KEY")==0)
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe:
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com