Issue #11603: Fix a crash when __str__ is rebound as __repr__.
Patch by Andreas Stührk.
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 @@
         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):
diff --git a/Misc/NEWS b/Misc/NEWS
index 63d5c24..b14e169 100644
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -13,6 +13,9 @@
 Library
 -------
 
+- Issue #11603: Fix a crash when __str__ is rebound as __repr__.  Patch by
+  Andreas Stührk.
+
 
 What's New in Python 3.1.4?
 ===========================
diff --git a/Objects/typeobject.c b/Objects/typeobject.c
index 5c20e0d..70971f3 100644
--- a/Objects/typeobject.c
+++ b/Objects/typeobject.c
@@ -2821,7 +2821,7 @@
     unaryfunc f;
 
     f = Py_TYPE(self)->tp_repr;
-    if (f == NULL)
+    if (f == NULL || f == object_str)
         f = object_repr;
     return f(self);
 }