Author: Philip Jenvey <pjen...@underboss.org> Branch: py3k Changeset: r61396:024efa6277ff Date: 2013-02-17 20:21 -0800 http://bitbucket.org/pypy/pypy/changeset/024efa6277ff/
Log: fix test_syslog diff --git a/lib_pypy/syslog.py b/lib_pypy/syslog.py --- a/lib_pypy/syslog.py +++ b/lib_pypy/syslog.py @@ -56,6 +56,11 @@ global _S_ident_o, _S_log_open if ident is None: ident = _get_argv() + if ident is not None: + if not isinstance(ident, str): + msg = "openlog() argument 1 must be a str, not {!r}" + raise TypeError(msg.format(type(ident).__name__)) + ident = ident.encode(sys.getdefaultencoding()) _S_ident_o = c_char_p(ident) # keepalive _openlog(_S_ident_o, logoption, facility) _S_log_open = True @@ -69,7 +74,11 @@ # if log is not opened, open it now if not _S_log_open: openlog() - _syslog(priority, "%s", message) + if not isinstance(message, str): + raise TypeError("syslog() message must be a str, not {!r}".format( + type(message).__name__)) + message = message.encode(sys.getdefaultencoding()) + _syslog(priority, b"%s", message) @builtinify def closelog(): _______________________________________________ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit