Author: Armin Rigo <[email protected]>
Branch: release-4.0.x
Changeset: r80703:aa291d1575e0
Date: 2015-11-16 11:01 +0100
http://bitbucket.org/pypy/pypy/changeset/aa291d1575e0/
Log: merge default into release again
diff --git a/rpython/translator/c/src/debug_print.c
b/rpython/translator/c/src/debug_print.c
--- a/rpython/translator/c/src/debug_print.c
+++ b/rpython/translator/c/src/debug_print.c
@@ -102,9 +102,14 @@
{
if (!debug_ready)
return -1;
+ /* The following fflush() makes sure everything is written now, which
+ is just before a fork(). So we can fork() and close the file in
+ the subprocess without ending up with the content of the buffer
+ written twice. */
+ fflush(pypy_debug_file);
+
// note that we deliberately ignore errno, since -1 is fine
// in case this is not a real file
- fflush(pypy_debug_file);
return ftell(pypy_debug_file);
}
@@ -123,7 +128,8 @@
if (pypy_debug_file)
{
- fclose(pypy_debug_file);
+ if (pypy_debug_file != stderr)
+ fclose(pypy_debug_file);
pypy_debug_file = NULL;
/* if PYPYLOG was set to a name with "%d" in it, it is still
alive, and will be reopened with the new subprocess' pid as
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit