#3242: fix a crash in "print", if sys.stdout is set to a custom object,
whose write() method installs another sys.stdout.

Will backport.
diff --git a/Misc/NEWS b/Misc/NEWS
index af95f94..64b9751 100644
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -10,6 +10,10 @@
 Core and Builtins
 -----------------
 
+- Issue #3242: Fix a crash inside the print statement, if sys.stdout is
+  set to a custom object whose write() method happens to install
+  another file in sys.stdout.
+
 - Issue #3088: Corrected a race condition in classes derived from
   threading.local: the first member set by a thread could be saved in
   another thread's dictionary.