diff options
author | Amaury Forgeot d'Arc <amauryfa@gmail.com> | 2008-07-01 20:52:56 (GMT) |
---|---|---|
committer | Amaury Forgeot d'Arc <amauryfa@gmail.com> | 2008-07-01 20:52:56 (GMT) |
commit | ceda6a67ce93dd9ac982ead61a23f98f85ea1821 (patch) | |
tree | afbcf17649cc2972bf0267f8b32391a2eb48969f /Python/ceval.c | |
parent | 6fa30f40b50e9f98579d16ee8358b75b898f13de (diff) | |
download | cpython-ceda6a67ce93dd9ac982ead61a23f98f85ea1821.zip cpython-ceda6a67ce93dd9ac982ead61a23f98f85ea1821.tar.gz cpython-ceda6a67ce93dd9ac982ead61a23f98f85ea1821.tar.bz2 |
#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
Diffstat (limited to 'Python/ceval.c')
-rw-r--r-- | Python/ceval.c | 2 |
1 files changed, 2 insertions, 0 deletions
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 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag) "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; |