summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_descr.py
diff options
context:
space:
mode:
authorAntoine Pitrou <solipsis@pitrou.net>2011-07-15 19:18:18 (GMT)
committerAntoine Pitrou <solipsis@pitrou.net>2011-07-15 19:18:18 (GMT)
commit9b43b6e14e65b6086d0d3227cfd600d4bbb38cc2 (patch)
tree43e635e7aee927dd58a9496d822b7de8e778a15d /Lib/test/test_descr.py
parent874d65afaef54993eb5779c31611f5f3baa995e2 (diff)
parentff35050493edd0c738ab69f14ee2fb5db11bb5ec (diff)
downloadcpython-9b43b6e14e65b6086d0d3227cfd600d4bbb38cc2.zip
cpython-9b43b6e14e65b6086d0d3227cfd600d4bbb38cc2.tar.gz
cpython-9b43b6e14e65b6086d0d3227cfd600d4bbb38cc2.tar.bz2
Issue #11603: Fix a crash when __str__ is rebound as __repr__.
Patch by Andreas Stührk.
Diffstat (limited to 'Lib/test/test_descr.py')
-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 0fae2df..4a02ec1 100644
--- a/Lib/test/test_descr.py
+++ b/Lib/test/test_descr.py
@@ -4247,6 +4247,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):