From 039dfa06461d3e71a6c7f07dbe0fc71788c38f05 Mon Sep 17 00:00:00 2001 From: Jeff Quast Date: Sat, 3 Jan 2015 22:21:13 -0800 Subject: 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 ;/ --- blessed/terminal.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) 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)) -- cgit v1.2.1