diff options
author | Victor Stinner <victor.stinner@haypocalc.com> | 2011-04-01 15:34:01 +0200 |
---|---|---|
committer | Victor Stinner <victor.stinner@haypocalc.com> | 2011-04-01 15:34:01 +0200 |
commit | 28169f0c91398cc93c3c5d114f055ab1e3ecbd59 (patch) | |
tree | f21ad0880f92c85f598b0d9b9a9eb9ff750fb7fa /Python/traceback.c | |
parent | 4e7ba81a65b6acded5150e4dce4012da512e7639 (diff) | |
download | cpython-28169f0c91398cc93c3c5d114f055ab1e3ecbd59.tar.gz |
Issue #11393: _Py_DumpTraceback() writes the header even if there is no frame
Diffstat (limited to 'Python/traceback.c')
-rw-r--r-- | Python/traceback.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/Python/traceback.c b/Python/traceback.c index 37673d93e0..f0142da792 100644 --- a/Python/traceback.c +++ b/Python/traceback.c @@ -556,18 +556,19 @@ dump_frame(int fd, PyFrameObject *frame) write(fd, "\n", 1); } -static int +static void dump_traceback(int fd, PyThreadState *tstate, int write_header) { PyFrameObject *frame; unsigned int depth; + if (write_header) + PUTS(fd, "Traceback (most recent call first):\n"); + frame = _PyThreadState_GetFrame(tstate); if (frame == NULL) - return -1; + return; - if (write_header) - PUTS(fd, "Traceback (most recent call first):\n"); depth = 0; while (frame != NULL) { if (MAX_FRAME_DEPTH <= depth) { @@ -580,13 +581,12 @@ dump_traceback(int fd, PyThreadState *tstate, int write_header) frame = frame->f_back; depth++; } - return 0; } -int +void _Py_DumpTraceback(int fd, PyThreadState *tstate) { - return dump_traceback(fd, tstate, 1); + dump_traceback(fd, tstate, 1); } /* Write the thread identifier into the file 'fd': "Current thread 0xHHHH:\" if |