diff options
author | Antoine Pitrou <solipsis@pitrou.net> | 2011-07-15 19:22:50 (GMT) |
---|---|---|
committer | Antoine Pitrou <solipsis@pitrou.net> | 2011-07-15 19:22:50 (GMT) |
commit | 304f0f952da3c2f1d354b1701aa5ad61b53ff179 (patch) | |
tree | 1490aabd08b8e3c44dac02824a959c32bd6ab064 /Lib/test/test_descr.py | |
parent | c3349cd22e9877a0516d8baa71530f87bf5ac430 (diff) | |
download | cpython-304f0f952da3c2f1d354b1701aa5ad61b53ff179.zip cpython-304f0f952da3c2f1d354b1701aa5ad61b53ff179.tar.gz cpython-304f0f952da3c2f1d354b1701aa5ad61b53ff179.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.py | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/Lib/test/test_descr.py b/Lib/test/test_descr.py index b5d9890..964cc5c 100644 --- a/Lib/test/test_descr.py +++ b/Lib/test/test_descr.py @@ -4581,6 +4581,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(object): + pass + Foo.__repr__ = Foo.__str__ + foo = Foo() + str(foo) class DictProxyTests(unittest.TestCase): def setUp(self): |