[pypy-commit] pypy py3.5: This dict.update() call can raise RuntimeError or not, even on CPython.

arigo pypy.commits at gmail.com
Tue Oct 18 05:11:13 EDT 2016


Author: Armin Rigo <arigo at tunes.org>
Branch: py3.5
Changeset: r87857:17255e31217c
Date: 2016-10-18 11:09 +0200
http://bitbucket.org/pypy/pypy/changeset/17255e31217c/

Log:	This dict.update() call can raise RuntimeError or not, even on
	CPython. On PyPy it will not. Change the test to check that it never
	crashes, but may or may not raise RuntimeError.

diff --git a/lib-python/3/test/test_dict.py b/lib-python/3/test/test_dict.py
--- a/lib-python/3/test/test_dict.py
+++ b/lib-python/3/test/test_dict.py
@@ -951,7 +951,12 @@
         other = dict(l)
         other[X()] = 0
         d = {X(): 0, 1: 1}
-        self.assertRaises(RuntimeError, d.update, other)
+        # should not crash, but can raise RuntimeError (CPython)
+        # or not (PyPy)
+        try:
+            d.update(other)
+        except RuntimeError:
+            pass
 
 from test import mapping_tests
 


More information about the pypy-commit mailing list