Author: Marius Gedminas <[email protected]>
Branch: py3k
Changeset: r77995:b110a435b27a
Date: 2015-04-02 11:23 +0300
http://bitbucket.org/pypy/pypy/changeset/b110a435b27a/
Log: Fix curses text-output functions and methods
The fix works for pure ASCII text only. I'm still investigating why
Unicode text results in output like 'M-D~EM-D~MM-D~Y'.
diff --git a/lib_pypy/_curses.py b/lib_pypy/_curses.py
--- a/lib_pypy/_curses.py
+++ b/lib_pypy/_curses.py
@@ -485,12 +485,12 @@
return int(ffi.cast("chtype", ch))
def _texttype(text):
- if isinstance(text, str):
+ if isinstance(text, bytes):
return text
- elif isinstance(text, unicode):
- return str(text) # default encoding
+ elif isinstance(text, str):
+ return text.encode('utf-8')
else:
- raise TypeError("str or unicode expected, got a '%s' object"
+ raise TypeError("str or bytes expected, got a '%s' object"
% (type(text).__name__,))
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit