[pypy-commit] pypy release-4.0.x: merge default into release again

arigo noreply at buildbot.pypy.org
Sun Nov 15 17:56:48 EST 2015


Author: Armin Rigo <arigo at tunes.org>
Branch: release-4.0.x
Changeset: r80699:694f248e5522
Date: 2015-11-15 23:57 +0100
http://bitbucket.org/pypy/pypy/changeset/694f248e5522/

Log:	merge default into release again

diff --git a/pypy/doc/release-4.0.1.rst b/pypy/doc/release-4.0.1.rst
--- a/pypy/doc/release-4.0.1.rst
+++ b/pypy/doc/release-4.0.1.rst
@@ -81,7 +81,9 @@
 
   * Support stackless and greenlets on PPC machines
 
-  * Improve debug logging in subprocesses when using PYPYLOG=..:log.$$
+  * Improve debug logging in subprocesses: use PYPYLOG=jit:log.%d
+    for example to have all subprocesses write the JIT log to a file
+    called 'log.%d', with '%d' replaced with the subprocess' PID.
 
   * Support PyOS_double_to_string in our cpyext capi compatibility layer
 
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
@@ -30,7 +30,7 @@
 
   if (filename && filename[0])
     {
-      char *newfilename = NULL, *doubledollar;
+      char *newfilename = NULL, *escape;
       char *colon = strchr(filename, ':');
       if (filename[0] == '+')
         {
@@ -52,17 +52,17 @@
           debug_prefix[n] = '\0';
           filename = colon + 1;
         }
-      doubledollar = strstr(filename, "$$");
-      if (doubledollar)  /* a "$$" in the filename is replaced with the pid */
+      escape = strstr(filename, "%d");
+      if (escape)  /* a "%d" in the filename is replaced with the pid */
         {
           newfilename = malloc(strlen(filename) + 32);
           if (newfilename != NULL)
             {
               char *p = newfilename;
-              memcpy(p, filename, doubledollar - filename);
-              p += doubledollar - filename;
+              memcpy(p, filename, escape - filename);
+              p += escape - filename;
               sprintf(p, "%ld", (long)getpid());
-              strcat(p, doubledollar + 2);
+              strcat(p, escape + 2);
               filename = newfilename;
             }
         }
@@ -71,7 +71,7 @@
           pypy_debug_file = fopen(filename, "w");
         }
 
-      if (doubledollar)
+      if (escape)
         {
           free(newfilename);   /* if not null */
           /* the env var is kept and passed to subprocesses */
@@ -125,7 +125,7 @@
     {
       fclose(pypy_debug_file);
       pypy_debug_file = NULL;
-      /* if PYPYLOG was set to a name with "$$" in it, it is still
+      /* 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
          soon as it logs anything */
       debug_ready = 0;
diff --git a/rpython/translator/c/src/debug_print.h b/rpython/translator/c/src/debug_print.h
--- a/rpython/translator/c/src/debug_print.h
+++ b/rpython/translator/c/src/debug_print.h
@@ -21,9 +21,9 @@
    subsections.
 
    Note that 'fname' can be '-' to send the logging data to stderr.
-   If 'fname' includes the substring '$$', it is replaced with the
+   If 'fname' includes the substring '%d' it is replaced with the
    current process id and you get the log for all subprocesses (and
-   forks) in different files.  If 'fname' does not include '$$', it is
+   forks) in different files.  If 'fname' does not include '%d', it is
    removed from the environment and not passed to subprocesses.
 */
 
diff --git a/rpython/translator/c/test/test_standalone.py b/rpython/translator/c/test/test_standalone.py
--- a/rpython/translator/c/test/test_standalone.py
+++ b/rpython/translator/c/test/test_standalone.py
@@ -544,7 +544,7 @@
         t, cbuilder = self.compile(entry_point)
         path = udir.join('test_debug_print_fork.log')
         out, err = cbuilder.cmdexec("", err=True,
-                                    env={'PYPYLOG': ':%s.$$' % path})
+                                    env={'PYPYLOG': ':%s.%%d' % path})
         assert not err
         import time
         time.sleep(0.5)    # time for the forked children to finish


More information about the pypy-commit mailing list