mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
Issue #11603: Fix a crash when __str__ is rebound as __repr__.
Patch by Andreas Stührk.
This commit is contained in:
commit
ff35050493
3 changed files with 12 additions and 1 deletions
|
@ -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):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue