summaryrefslogtreecommitdiffstats
path: root/Lib/test
diff options
context:
space:
mode:
authorAntoine Pitrou <solipsis@pitrou.net>2011-07-15 19:15:07 (GMT)
committerAntoine Pitrou <solipsis@pitrou.net>2011-07-15 19:15:07 (GMT)
commit8cdc40e3b0622ea4eeb8b2c9b0e6796be685d16d (patch)
treeb0570fc82de1c24aee5e81c8199de476179ca35f /Lib/test
parente22813067e4f62629a9c24947c29a55861fb05f1 (diff)
downloadcpython-8cdc40e3b0622ea4eeb8b2c9b0e6796be685d16d.zip
cpython-8cdc40e3b0622ea4eeb8b2c9b0e6796be685d16d.tar.gz
cpython-8cdc40e3b0622ea4eeb8b2c9b0e6796be685d16d.tar.bz2
Issue #11603: Fix a crash when __str__ is rebound as __repr__.
Patch by Andreas Stührk.
Diffstat (limited to 'Lib/test')
-rw-r--r--Lib/test/test_descr.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/Lib/test/test_descr.py b/Lib/test/test_descr.py
index c74e232..0ce85f0 100644
--- a/Lib/test/test_descr.py
+++ b/Lib/test/test_descr.py
@@ -4252,6 +4252,14 @@ order (MRO) for bases """
with self.assertRaises(TypeError):
str.__add__(fake_str, "abc")
+ def test_repr_as_str(self):
+ # Issue #11603: crash or infinite loop when rebinding __str__ as
+ # __repr__.
+ class Foo:
+ pass
+ Foo.__repr__ = Foo.__str__
+ foo = Foo()
+ str(foo)
class DictProxyTests(unittest.TestCase):
def setUp(self):