summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff Quast <jquast@io.com>2015-01-03 22:21:13 -0800
committerJeff Quast <jquast@io.com>2015-01-03 22:21:13 -0800
commit039dfa06461d3e71a6c7f07dbe0fc71788c38f05 (patch)
treec009a32b97250ad0f4880f9d4a87b14a9c52a993
parent213c3a52a8f64ae147f4cb240a85a7f789bfff5d (diff)
downloadblessings-039dfa06461d3e71a6c7f07dbe0fc71788c38f05.tar.gz
add pypy kind unicode workaround in __init__
we could fix the tests, but this might help somebody else out along the line. Why is pypy always so difficult ;/
-rw-r--r--blessed/terminal.py9
1 files changed, 8 insertions, 1 deletions
diff --git a/blessed/terminal.py b/blessed/terminal.py
index b379719..1e17d73 100644
--- a/blessed/terminal.py
+++ b/blessed/terminal.py
@@ -4,6 +4,7 @@ import collections
import contextlib
import functools
import warnings
+import platform
import codecs
import curses
import locale
@@ -180,7 +181,13 @@ class Terminal(object):
# send them to stdout as a fallback, since they have to go
# somewhere.
try:
- curses.setupterm(self._kind, self._init_descriptor)
+ if (platform.python_implementation() == 'PyPy' and
+ isinstance(self._kind, unicode)):
+ # pypy/2.4.0_2/libexec/lib_pypy/_curses.py, line 1131
+ # TypeError: initializer for ctype 'char *' must be a str
+ curses.setupterm(self._kind.encode('ascii'), self._init_descriptor)
+ else:
+ curses.setupterm(self._kind, self._init_descriptor)
except curses.error as err:
warnings.warn('Failed to setupterm(kind={0!r}): {1}'
.format(self._kind, err))