This issue tracker has been migrated to GitHub ,
and is currently read-only.
For more information,
see the GitHub FAQs in the Python's Developer Guide.
Created on 2013年10月20日 00:23 by gvanrossum, last changed 2022年04月11日 14:57 by admin. This issue is now closed.
| Files | ||||
|---|---|---|---|---|
| File name | Uploaded | Description | Edit | |
| traceback.diff | gvanrossum, 2013年10月20日 03:26 | review | ||
| traceback2.diff | gvanrossum, 2013年10月20日 23:41 | review | ||
| Messages (8) | |||
|---|---|---|---|
| msg200527 - (view) | Author: Guido van Rossum (gvanrossum) * (Python committer) | Date: 2013年10月20日 00:23 | |
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* |
|||
| msg200537 - (view) | Author: Guido van Rossum (gvanrossum) * (Python committer) | Date: 2013年10月20日 03:26 | |
BTW, another oddity in traceback.c: dump_hexadecimal() has the "int fd" argument at the end, while all other dump_*() functions have it at the front -- even its cousin dump_decimal(). Here's a patch that includes a fix. |
|||
| msg200550 - (view) | Author: STINNER Victor (vstinner) * (Python committer) | Date: 2013年10月20日 07:41 | |
You must update unit tests in test_faulthandler. |
|||
| msg200655 - (view) | Author: Guido van Rossum (gvanrossum) * (Python committer) | Date: 2013年10月20日 23:41 | |
New patch, with fixed test. TBH now I'm getting worried that other programs may exist that parse this format and will get confused. |
|||
| msg200660 - (view) | Author: STINNER Victor (vstinner) * (Python committer) | Date: 2013年10月21日 00:03 | |
> TBH now I'm getting worried that other programs may exist that parse this format and will get confused. A program parsing faulthandler output? Seriously? It would be nice, but I don't know any. Anyway, such program would probably use a regex to parse the output, and it's very easy to support Python 3.3 format and patched (future 3.4) format. > New patch, with fixed test. Thanks. The patch looks good to me, you can push it. |
|||
| msg200678 - (view) | Author: Roundup Robot (python-dev) (Python triager) | Date: 2013年10月21日 01:21 | |
New changeset cc8c37b5b449 by Guido van Rossum in branch 'default': Issue 19306: Add extra hints to faulthandler stack dumps that they are upside down. http://hg.python.org/cpython/rev/cc8c37b5b449 |
|||
| msg200685 - (view) | Author: Guido van Rossum (gvanrossum) * (Python committer) | Date: 2013年10月21日 02:18 | |
On Victor's authority, committed. I've also (separately) committed some doc changes. |
|||
| msg200712 - (view) | Author: STINNER Victor (vstinner) * (Python committer) | Date: 2013年10月21日 08:00 | |
Thanks. "(most recent call first)" was already present in some cases, but I forgot to mention it in all cases. |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022年04月11日 14:57:52 | admin | set | github: 63505 |
| 2013年10月21日 08:00:25 | vstinner | set | messages: + msg200712 |
| 2013年10月21日 02:18:37 | gvanrossum | set | status: open -> closed resolution: fixed messages: + msg200685 stage: patch review -> resolved |
| 2013年10月21日 01:21:11 | python-dev | set | nosy:
+ python-dev messages: + msg200678 |
| 2013年10月21日 00:03:38 | vstinner | set | messages: + msg200660 |
| 2013年10月20日 23:41:44 | gvanrossum | set | files:
+ traceback2.diff messages: + msg200655 |
| 2013年10月20日 07:41:23 | vstinner | set | messages: + msg200550 |
| 2013年10月20日 03:26:56 | gvanrossum | set | files:
+ traceback.diff keywords: + patch messages: + msg200537 |
| 2013年10月20日 00:28:56 | pitrou | set | assignee: pitrou -> vstinner nosy: + vstinner |
| 2013年10月20日 00:23:25 | gvanrossum | create | |