From cc9f097936226845a89d879d49f38894dd032d03 Mon Sep 17 00:00:00 2001 From: Jason Madden Date: Mon, 11 Sep 2017 11:28:00 -0500 Subject: Fix non-ASCII supplement info under Python 2 and drop Py3.3. Fixes #1. Fix the coverage environment using zope.testrunner (nose no longer works, that same namespace path issue). Also run the doctests on all supported versions. This requires dropping Python 3.3 because sphinx needs 3.4+. --- src/zope/exceptions/log.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'src/zope/exceptions/log.py') diff --git a/src/zope/exceptions/log.py b/src/zope/exceptions/log.py index 735429a..574ccd3 100644 --- a/src/zope/exceptions/log.py +++ b/src/zope/exceptions/log.py @@ -15,13 +15,11 @@ """ import logging -try: - from StringIO import StringIO -except ImportError: #pragma: no cover Python3 - from io import StringIO +import io from zope.exceptions.exceptionformatter import print_exception +Buffer = io.StringIO if bytes is not str else io.BytesIO class Formatter(logging.Formatter): @@ -30,7 +28,7 @@ class Formatter(logging.Formatter): Uses zope.exceptions.exceptionformatter to generate the traceback. """ - sio = StringIO() + sio = Buffer() print_exception(ei[0], ei[1], ei[2], file=sio, with_filenames=True) s = sio.getvalue() if s.endswith("\n"): -- cgit v1.2.1