tuple.__repr__ did not consider a reference loop as it is not possible from
Python code; but it is possible from C. object.__str__ had the issue of not
expecting a type to doing something within it's tp_str implementation that
could trigger an infinite recursion, but it could in C code.. Both found
thanks to BaseException and how it handles its repr.
Closes issue #1686386. Thanks to Thomas Herve for taking an initial stab at
coming up with a solution.
diff --git a/Misc/NEWS b/Misc/NEWS
index 2dadbbf..b01633a 100644
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -12,6 +12,12 @@
Core and builtins
-----------------
+- Issue #1686386: Tuple's tp_repr did not take into account the possibility of
+ having a self-referential tuple, which is possible from C code. Nor did
+ object's tp_str consider that a type's tp_str could do something that could
+ lead to an inifinite recursion. Py_ReprEnter() and Py_EnterRecursiveCall(),
+ respectively, fixed the issues.
+
- Issue #1164: It was possible to trigger deadlock when using the 'print'
statement to write to a file since the GIL was not released as needed. Now
PyObject_Print() does the right thing along with various tp_print