Backport trunk revision 53527:
SF patch #1630975: Fix crash when replacing sys.stdout in sitecustomize
When running the interpreter in an environment that would cause it to set
stdout/stderr/stdin's encoding, having a sitecustomize that would replace
them with something other than PyFile objects would crash the interpreter.
Fix it by simply ignoring the encoding-setting for non-files.
This could do with a test, but I can think of no maintainable and portable
way to test this bug, short of adding a sitecustomize.py to the buildsystem
and have it always run with it (hmmm....)
diff --git a/Misc/NEWS b/Misc/NEWS
index 9876af9..f30f50b 100644
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -12,6 +12,8 @@
Core and builtins
-----------------
+- patch #1630975: Fix crash when replacing sys.stdout in sitecustomize.py
+
- Bug #1637022: Prefix AST symbols with _Py_.
- Prevent seg fault on shutdown which could occur if an object