commit | ceda6a67ce93dd9ac982ead61a23f98f85ea1821 | [log] [tgz] |
---|---|---|
author | Amaury Forgeot d'Arc <amauryfa@gmail.com> | Tue Jul 01 20:52:56 2008 +0000 |
committer | Amaury Forgeot d'Arc <amauryfa@gmail.com> | Tue Jul 01 20:52:56 2008 +0000 |
tree | afbcf17649cc2972bf0267f8b32391a2eb48969f | |
parent | 6fa30f40b50e9f98579d16ee8358b75b898f13de [diff] [blame] |
#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
diff --git a/Python/ceval.c b/Python/ceval.c index 06d524b..9bc147b 100644 --- a/Python/ceval.c +++ b/Python/ceval.c
@@ -1603,9 +1603,11 @@ "lost sys.stdout"); } if (w != NULL) { + Py_INCREF(w); err = PyFile_WriteString("\n", w); if (err == 0) PyFile_SoftSpace(w, 0); + Py_DECREF(w); } Py_XDECREF(stream); stream = NULL;