cpython: 27b5bd5f0e4c (original) (raw)
Mercurial > cpython
changeset 78831:27b5bd5f0e4c
Close #14223: Fix window.addch(curses.ACS_HLINE) Fix window.addch() of the curses module for special characters like curses.ACS_HLINE: the Python function addch(int) and addch(bytes) is now calling the C function waddch()/mvwaddch() (as it was done in Python 3.2), instead of wadd_wch()/mvwadd_wch(). The Python function addch(str) is still calling the C function wadd_wch()/mvwadd_wch() if the Python curses is linked to libncursesw. [#14223]
Victor Stinner victor.stinner@gmail.com | |
---|---|
date | Sat, 01 Sep 2012 15:00:34 +0200 |
parents | 895e123d9476 |
children | e2e4a0a49d2e |
files | Misc/NEWS Modules/_cursesmodule.c |
diffstat | 2 files changed, 14 insertions(+), 27 deletions(-)[+] [-] Misc/NEWS 7 Modules/_cursesmodule.c 34 |
line wrap: on
line diff
--- a/Misc/NEWS +++ b/Misc/NEWS @@ -73,6 +73,13 @@ Library always returning an integer. So it is now possible to distinguish special keys like keypad keys. +- Issue #14223: Fix window.addch() of the curses module for special characters
- like curses.ACS_HLINE: the Python function addch(int) and addch(bytes) is now
- calling the C function waddch()/mvwaddch() (as it was done in Python 3.2),
- instead of wadd_wch()/mvwadd_wch(). The Python function addch(str) is still
- calling the C function wadd_wch()/mvwadd_wch() if the Python curses is linked
- to libncursesw. + What's New in Python 3.3.0 Release Candidate 1? ===============================================
--- a/Modules/_cursesmodule.c +++ b/Modules/_cursesmodule.c @@ -280,7 +280,6 @@ PyCurses_ConvertToCchar_t(PyCursesWindow #endif ) {
#ifdef HAVE_NCURSESW wchar_t buffer[2]; @@ -304,7 +303,6 @@ PyCurses_ConvertToCchar_t(PyCursesWindow } else if(PyBytes_Check(obj) && PyBytes_Size(obj) == 1) { value = (unsigned char)PyBytes_AsString(obj)[0];
@@ -314,11 +312,6 @@ PyCurses_ConvertToCchar_t(PyCursesWindow "int doesn't fit in long"); return 0; } -#ifdef HAVE_NCURSESW
ret = 2;[](#l2.24)
ret = 1;[](#l2.26)
-#endif } else { PyErr_Format(PyExc_TypeError, @@ -326,27 +319,14 @@ PyCurses_ConvertToCchar_t(PyCursesWindow Py_TYPE(obj)->tp_name); return 0; } -#ifdef HAVE_NCURSESW
- if (ret == 2) {
memset(wch->chars, 0, sizeof(wch->chars));[](#l2.37)
wch->chars[0] = (wchar_t)value;[](#l2.38)
if ((long)wch->chars[0] != value) {[](#l2.39)
PyErr_Format(PyExc_OverflowError,[](#l2.40)
"character doesn't fit in wchar_t");[](#l2.41)
return 0;[](#l2.42)
}[](#l2.43)
- *ch = (chtype)value;
- if ((long)*ch != value) {
PyErr_Format(PyExc_OverflowError,[](#l2.47)
"byte doesn't fit in chtype");[](#l2.48)
}return 0;[](#l2.49)
- {
*ch = (chtype)value;[](#l2.54)
if ((long)*ch != value) {[](#l2.55)
PyErr_Format(PyExc_OverflowError,[](#l2.56)
"byte doesn't fit in chtype");[](#l2.57)
return 0;[](#l2.58)
}[](#l2.59)
- }
- return ret;
} /* Convert an object to a byte string (char*) or a wide character string