Antoine Pitrou <pit...@free.fr> added the comment:

Does the following patch solve your issue?


Index: Python/ceval.c
===================================================================
--- Python/ceval.c      (révision 82959)
+++ Python/ceval.c      (copie de travail)
@@ -1763,6 +1763,8 @@
                If __getattr__ raises an exception, w will
                be freed, so we need to prevent that temporarily. */
             Py_XINCREF(w);
+            if (PyFile_Check(w))
+                PyFile_IncUseCount((PyFileObject *) w);
             if (w != NULL && PyFile_SoftSpace(w, 0))
                 err = PyFile_WriteString(" ", w);
             if (err == 0)
@@ -1790,6 +1792,8 @@
                 else
                     PyFile_SoftSpace(w, 1);
             }
+            if (PyFile_Check(w))
+                PyFile_DecUseCount((PyFileObject *) w);
             Py_XDECREF(w);
             Py_DECREF(v);
             Py_XDECREF(stream);

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue9295>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to