diff options
Diffstat (limited to 'blessed/terminal.py')
-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)) |