diff Python/import.c @ 43712:00b136b7da84

Patch 1329 (partial) by Christian Heimes. Add a closefd flag to open() which can be set to False to prevent closing the file descriptor when close() is called or when the object is destroyed. Useful to ensure that sys.std{in,out,err} keep their file descriptors open when Python is uninitialized. (This was always a feature in 2.x, it just wasn't implemented in 3.0 yet.)
author Guido van Rossum <guido@python.org>
date Tue, 30 Oct 2007 17:27:30 +0000
parents 0067a6ab4854
children de3b63f8b17b
line wrap: on
line diff
--- a/Python/import.c	Mon Oct 29 19:54:24 2007 +0000
+++ b/Python/import.c	Tue Oct 30 17:27:30 2007 +0000
@@ -2588,7 +2588,7 @@
 				   (char*)PyUnicode_GetDefaultEncoding();
 		}
 		fob = PyFile_FromFd(fd, pathname, fdp->mode, -1,
-					(char*)encoding, NULL);
+				    (char*)encoding, NULL, 1);
 		if (fob == NULL) {
 			close(fd);
 			PyMem_FREE(found_encoding);