Neal Norwitz added the comment:

When I run with the attached patch, I see the message: 

*** dtor called in python ...

Is that the behavior you expect?

Added file: http://bugs.python.org/file8626/stdout-close.patch

__________________________________
Tracker <[EMAIL PROTECTED]>
<http://bugs.python.org/issue1329>
__________________________________
Index: Python/pythonrun.c
===================================================================
--- Python/pythonrun.c	(revision 58681)
+++ Python/pythonrun.c	(working copy)
@@ -725,7 +725,8 @@
 	}
 	PySys_SetObject("__stdin__", std);
 	PySys_SetObject("stdin", std);
-	Py_DECREF(std);
+	/* Purposefully lose a ref to stdin so it is never closed. */
+	/* Py_DECREF(std); */
 
 	/* Set sys.stdout */
 	if (!(std = PyFile_FromFd(fileno(stdout), "<stdout>", "w", -1,
@@ -734,7 +735,8 @@
         }
 	PySys_SetObject("__stdout__", std);
 	PySys_SetObject("stdout", std);
-	Py_DECREF(std);
+	/* Purposefully lose a ref to stdout so it is never closed. */
+	/* Py_DECREF(std); */
 
 	/* Set sys.stderr */
 	if (!(std = PyFile_FromFd(fileno(stderr), "<stderr>", "w", -1,
@@ -743,7 +745,8 @@
         }
         PySys_SetObject("__stderr__", std);
 	PySys_SetObject("stderr", std);
-	Py_DECREF(std);
+	/* Purposefully lose a ref to stderr so it is never closed. */
+	/* Py_DECREF(std); */
 
         if (0) {
   error:
_______________________________________________
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to