[pypy-commit] pypy py3k: revert part of ed5309c80fdf and adapt its test to this branch: py3k doesn't

pjenvey noreply at buildbot.pypy.org
Wed Nov 20 02:30:55 CET 2013


Author: Philip Jenvey <pjenvey at underboss.org>
Branch: py3k
Changeset: r68253:a95599228f5a
Date: 2013-11-19 17:26 -0800
http://bitbucket.org/pypy/pypy/changeset/a95599228f5a/

Log:	revert part of ed5309c80fdf and adapt its test to this branch: py3k
	doesn't need these workarounds

diff --git a/pypy/module/sys/app.py b/pypy/module/sys/app.py
--- a/pypy/module/sys/app.py
+++ b/pypy/module/sys/app.py
@@ -20,13 +20,8 @@
         pass
 
     try:
-        encoding = sys.stderr.encoding
-    except:
-        encoding = None
-
-    try:
         from traceback import print_exception
-        print_exception(exctype, value, traceback, _encoding=encoding)
+        print_exception(exctype, value, traceback)
     except:
         if not excepthook_failsafe(exctype, value):
             raise
diff --git a/pypy/module/sys/test/test_sysmodule.py b/pypy/module/sys/test/test_sysmodule.py
--- a/pypy/module/sys/test/test_sysmodule.py
+++ b/pypy/module/sys/test/test_sysmodule.py
@@ -283,8 +283,7 @@
             def getvalue(self):
                 return ''.join(self.output)
 
-        for input, expectedoutput in [(u"\u013a", "\xe5"),
-                                      (u"\u1111", "\\u1111")]:
+        for input in ("\u013a", "\u1111"):
             err = MyStringIO()
             err.encoding = 'iso-8859-2'
             sys.stderr = err
@@ -292,12 +291,12 @@
             eh = sys.__excepthook__
             try:
                 raise ValueError(input)
-            except ValueError, exc:
+            except ValueError as exc:
                 eh(*sys.exc_info())
 
             sys.stderr = savestderr
-            print repr(err.getvalue())
-            assert err.getvalue().endswith("ValueError: %s\n" % expectedoutput)
+            print(ascii(err.getvalue()))
+            assert err.getvalue().endswith("ValueError: %s\n" % input)
 
     # FIXME: testing the code for a lost or replaced excepthook in
     # Python/pythonrun.c::PyErr_PrintEx() is tricky.


More information about the pypy-commit mailing list