diff options
author | Amaury Forgeot d'Arc <amauryfa@gmail.com> | 2008-07-01 20:38:04 (GMT) |
---|---|---|
committer | Amaury Forgeot d'Arc <amauryfa@gmail.com> | 2008-07-01 20:38:04 (GMT) |
commit | bdd941fac3631e0c971d6c1a4e9f9b39a787b14e (patch) | |
tree | 05028f6a4f65f7214d266282fdb78480e3d68ef3 /Python/ceval.c | |
parent | dbd0ae383d7e23dfe219704605b55f556d2ee914 (diff) | |
download | cpython-bdd941fac3631e0c971d6c1a4e9f9b39a787b14e.zip cpython-bdd941fac3631e0c971d6c1a4e9f9b39a787b14e.tar.gz cpython-bdd941fac3631e0c971d6c1a4e9f9b39a787b14e.tar.bz2 |
#3242: fix a crash in "print", if sys.stdout is set to a custom object,
whose write() method installs another sys.stdout.
Will backport.
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 0cff157..60a91b2 100644 --- a/Python/ceval.c +++ b/Python/ceval.c @@ -1617,9 +1617,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; |