[New-bugs-announce] [issue19306] Warn unsuspecting readers that thread stacks are in reverse order

Guido van Rossum report at bugs.python.org
Sun Oct 20 02:23:25 CEST 2013


New submission from Guido van Rossum:

I was confused for a while when seeing the thread stacks dumped by the faulthandler module.  (See issue 19293.)

I propose the following tweaks of the output to make this more obvious. The first chunk changes the header written when called as _Py_DumpTraceback(), the second change the per-thread headers printed by _Py_DumpTracebackThreads().

diff -r 02f6922e6a7e Python/traceback.c
--- a/Python/traceback.c        Sat Oct 19 17:04:25 2013 -0700
+++ b/Python/traceback.c        Sat Oct 19 17:19:29 2013 -0700
@@ -603,7 +603,7 @@
     unsigned int depth;

     if (write_header)
-        PUTS(fd, "Traceback (most recent call first):\n");
+        PUTS(fd, "Stack (most recent call first):\n");

     frame = _PyThreadState_GetFrame(tstate);
     if (frame == NULL)
@@ -642,7 +642,7 @@
     else
         PUTS(fd, "Thread 0x");
     dump_hexadecimal(sizeof(long)*2, (unsigned long)tstate->thread_id, fd);
-    PUTS(fd, ":\n");
+    PUTS(fd, " (most recent call first):\n");
 }

 const char*

----------
assignee: pitrou
keywords: easy
messages: 200527
nosy: gvanrossum, pitrou
priority: low
severity: normal
stage: patch review
status: open
title: Warn unsuspecting readers that thread stacks are in reverse order
type: enhancement
versions: Python 3.4

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue19306>
_______________________________________


More information about the New-bugs-announce mailing list