diff options
author | Jeff Quast <jquast@io.com> | 2015-01-03 22:21:13 -0800 |
---|---|---|
committer | Jeff Quast <jquast@io.com> | 2015-01-03 22:21:13 -0800 |
commit | 039dfa06461d3e71a6c7f07dbe0fc71788c38f05 (patch) | |
tree | c009a32b97250ad0f4880f9d4a87b14a9c52a993 | |
parent | 213c3a52a8f64ae147f4cb240a85a7f789bfff5d (diff) | |
download | blessings-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.py | 9 |
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)) |