diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2015-09-18 10:04:47 +0300 |
---|---|---|
committer | Serhiy Storchaka <storchaka@gmail.com> | 2015-09-18 10:04:47 +0300 |
commit | e953ba794cf172237e1101fed24f326b66e9fa9a (patch) | |
tree | 15869c1456201bcca62af191822818903258bc33 /Lib/traceback.py | |
parent | 7b51a55ecdd67df5ed9191048d6c1e500fc3f586 (diff) | |
download | cpython-git-e953ba794cf172237e1101fed24f326b66e9fa9a.tar.gz |
Issue #25108: Omitted internal frames in traceback functions print_stack(),
format_stack(), and extract_stack() called without arguments.
Diffstat (limited to 'Lib/traceback.py')
-rw-r--r-- | Lib/traceback.py | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/Lib/traceback.py b/Lib/traceback.py index 02edeb6217..112e9ba829 100644 --- a/Lib/traceback.py +++ b/Lib/traceback.py @@ -181,11 +181,15 @@ def print_stack(f=None, limit=None, file=None): stack frame at which to start. The optional 'limit' and 'file' arguments have the same meaning as for print_exception(). """ + if f is None: + f = sys._getframe().f_back print_list(extract_stack(f, limit=limit), file=file) def format_stack(f=None, limit=None): """Shorthand for 'format_list(extract_stack(f, limit))'.""" + if f is None: + f = sys._getframe().f_back return format_list(extract_stack(f, limit=limit)) @@ -198,6 +202,8 @@ def extract_stack(f=None, limit=None): line number, function name, text), and the entries are in order from oldest to newest stack frame. """ + if f is None: + f = sys._getframe().f_back stack = StackSummary.extract(walk_stack(f), limit=limit) stack.reverse() return stack |