Author: Matti Picus <[email protected]>
Branch: py3.6
Changeset: r97360:1e244de6b3ad
Date: 2019-09-01 08:29 +0300
http://bitbucket.org/pypy/pypy/changeset/1e244de6b3ad/

Log:    fix logic in _curses.get_wch (bb-3064, patch by Anthony Sottile)

diff --git a/lib_pypy/_curses.py b/lib_pypy/_curses.py
--- a/lib_pypy/_curses.py
+++ b/lib_pypy/_curses.py
@@ -412,7 +412,10 @@
         else:
             raise error("get_wch requires 0 or 2 arguments")
         _check_ERR(val, "get_wch")
-        return wch[0]
+        if val == lib.KEY_CODE_YES:
+            return wch[0]
+        else:
+            return chr(wch[0])
 
     def getkey(self, *args):
         if len(args) == 0:
diff --git a/lib_pypy/_curses_build.py b/lib_pypy/_curses_build.py
--- a/lib_pypy/_curses_build.py
+++ b/lib_pypy/_curses_build.py
@@ -90,6 +90,7 @@
 static const int ERR, OK;
 static const int TRUE, FALSE;
 static const int KEY_MIN, KEY_MAX;
+static const int KEY_CODE_YES;
 
 static const int COLOR_BLACK;
 static const int COLOR_RED;
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to