This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author christian.heimes
Recipients MrJean1, christian.heimes, gvanrossum, nnorwitz
Date 2007-10-28.17:03:58
SpamBayes Score 0.010686572
Marked as misclassified No
Message-id <1193591038.81.0.565635007659.issue1329@psf.upfronthosting.co.za>
In-reply-to
Content
Can you try this patch, please? It has the same effect as the other
patch from Neal but it doesn't loose ref counts. I've patched the
dealloc function of _FileIO to keep fd 1 and fd 2 open.

Index: Modules/_fileio.c
===================================================================
--- Modules/_fileio.c   (Revision 58699)
+++ Modules/_fileio.c   (Arbeitskopie)
@@ -270,7 +270,8 @@
        if (self->weakreflist != NULL)
                PyObject_ClearWeakRefs((PyObject *) self);

-       if (self->fd >= 0) {
+       /* Don't close stdout and stderr */
+       if (self->fd == 0 || self->fd > 2) {
                errno = internal_close(self);
                if (errno < 0) {
 #ifdef HAVE_STRERROR
History
Date User Action Args
2007-10-28 17:03:58christian.heimessetspambayes_score: 0.0106866 -> 0.010686572
recipients: + christian.heimes, gvanrossum, nnorwitz, MrJean1
2007-10-28 17:03:58christian.heimessetspambayes_score: 0.0106866 -> 0.0106866
messageid: <1193591038.81.0.565635007659.issue1329@psf.upfronthosting.co.za>
2007-10-28 17:03:58christian.heimeslinkissue1329 messages
2007-10-28 17:03:58christian.heimescreate