[pypy-commit] pypy py3.5: hg merge default

arigo pypy.commits at gmail.com
Thu Jul 5 11:30:51 EDT 2018


Author: Armin Rigo <arigo at tunes.org>
Branch: py3.5
Changeset: r94806:87b7c6c07f22
Date: 2018-07-05 17:28 +0200
http://bitbucket.org/pypy/pypy/changeset/87b7c6c07f22/

Log:	hg merge default

	(issue #2837 not closed, needs different fix in pypy3)

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
@@ -358,6 +358,29 @@
             print(ascii(err.getvalue()))
             assert err.getvalue().endswith("ValueError: %s\n" % input)
 
+    def test_excepthook_flushes_stdout(self): r"""
+        import sys, io
+        savestdout = sys.stdout
+        out = io.StringIO()
+        sys.stdout = out
+
+        eh = sys.__excepthook__
+
+        try:
+            raise ValueError(42)
+        except ValueError as exc:
+            print("hello")     # with end-of-line
+            eh(*sys.exc_info())
+        try:
+            raise ValueError(42)
+        except ValueError as exc:
+            print(123, 456, end="")     # no end-of-line here
+            eh(*sys.exc_info())
+
+        sys.stdout = savestdout
+        assert out.getvalue() == 'hello\n123 456'   # no final \n added in 3.x
+        """
+
     # FIXME: testing the code for a lost or replaced excepthook in
     # Python/pythonrun.c::PyErr_PrintEx() is tricky.
 
diff --git a/rpython/rlib/rvmprof/dummy.py b/rpython/rlib/rvmprof/dummy.py
--- a/rpython/rlib/rvmprof/dummy.py
+++ b/rpython/rlib/rvmprof/dummy.py
@@ -23,4 +23,4 @@
         pass
 
     def stop_sampling(self):
-        pass
+        return -1


More information about the pypy-commit mailing list