Mercurial > cpython-lru_cache-weakref
diff Python/ceval.c @ 47867:60fd0886811c 2.5
#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
| author | Amaury Forgeot d'Arc <amauryfa@gmail.com> |
|---|---|
| date | Tue, 01 Jul 2008 20:52:56 +0000 |
| parents | fdd74bdeee15 |
| children | 43fa50b9eb12 |
line wrap: on
line diff
--- a/Python/ceval.c Sun Jun 22 18:31:30 2008 +0000 +++ b/Python/ceval.c Tue Jul 01 20:52:56 2008 +0000 @@ -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;
