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

Backport of r64633
3 files changed