[pypy-commit] pypy merge-2.7.2: Allow both str.__add__ to raise TypeError or return NotImplemented.

amauryfa noreply at buildbot.pypy.org
Sun Jan 22 21:54:07 CET 2012


Author: Amaury Forgeot d'Arc <amauryfa at gmail.com>
Branch: merge-2.7.2
Changeset: r51666:c84666d936d2
Date: 2012-01-22 21:10 +0100
http://bitbucket.org/pypy/pypy/changeset/c84666d936d2/

Log:	Allow both str.__add__ to raise TypeError or return NotImplemented.

	IMO the point of the test is to check that str.__add__ does not
	crash or use str() instead.

diff --git a/lib-python/modified-2.7/test/test_descr.py b/lib-python/modified-2.7/test/test_descr.py
--- a/lib-python/modified-2.7/test/test_descr.py
+++ b/lib-python/modified-2.7/test/test_descr.py
@@ -4592,8 +4592,12 @@
             str.split(fake_str)
 
         # call a slot wrapper descriptor
-        with self.assertRaises(TypeError):
-            str.__add__(fake_str, "abc")
+        try:
+            r = str.__add__(fake_str, "abc")
+        except TypeError:
+            pass
+        else:
+            self.assertEqual(r, NotImplemented)
 
 
 class DictProxyTests(unittest.TestCase):


More information about the pypy-commit mailing list