Mercurial > cpython-lru_cache-weakref
diff Python/ceval.c @ 47864:7dbd6b607706 legacy-trunk
#3242: fix a crash in "print", if sys.stdout is set to a custom object,
whose write() method installs another sys.stdout.
Will backport.
| author | Amaury Forgeot d'Arc <amauryfa@gmail.com> |
|---|---|
| date | Tue, 01 Jul 2008 20:38:04 +0000 |
| parents | 52294af4b663 |
| children | 4a8329535234 |
line wrap: on
line diff
--- a/Python/ceval.c Tue Jul 01 20:18:10 2008 +0000 +++ b/Python/ceval.c Tue Jul 01 20:38:04 2008 +0000 @@ -1617,9 +1617,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;
