Convenience functions for the python execution stack.
Project description
I find the supplied python traceback facilities quite awkward. These functions provide convenient facilities.
Latest release 20220918: caller(): return None if the frame offset is out of range.
Function caller(frame_index=-3)
Return the Frame of the caller's caller.
Returns None if frame_index is out of range.
Useful frame_index values:
-1: caller, this function-2: invoker, who wants to know the caller-3: the calling function of the invoker
The default from_index value is -3.
Class Frame(Frame, builtins.tuple)
A namedtuple for stack frame contents.
Function frames()
Return the current stack as a list of Frame objects.
Function stack_dump(fp=None, indent=0, Fs=None, skip=None)
Recite current or supplied stack to fp, default sys.stderr.
Parameters:
fp: the output file object, defaultsys.stderrindent: how many spaces to indent the stack lines, default0Fs: the stackFrames to write, default obtained from the current stackskip: the number ofFrames to trim from the end ofFs; ifFsisNonethis defaults to2to trim theFrames for thestack_dumpfunction and its call toframes(), otherwise the default is0to use the suppliedFrames as is
Release Log
Release 20220918: caller(): return None if the frame offset is out of range.
Release 20220429: caller: return None if the stack index is out of range.
Release 20190812: stack_dump(): trim the last 2 frames from the listing by default (they are part of stack_dump's implementation).
Release 20190101:
- _Frame: rename .functionname to .funcname; caller: turn raw frames into Frames.
- caller(): accept optional frame_index, default -3.
Release 20160827: Add stack_dump().
Release 20150115: PyPI metadata fixups.
Release 20150111: Tag for initial PyPI release of cs.py.stack.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file cs.py.stack-20220918.tar.gz.
File metadata
- Download URL: cs.py.stack-20220918.tar.gz
- Upload date:
- Size: 3.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.9.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6c479fc51393d1af275066eb19907ba89da1c9097d1b513a8f9e846206321d94
|
|
| MD5 |
d803f170fe6b811710bd380cedb05895
|
|
| BLAKE2b-256 |
4ba0e1c6ec5c91f42051776fdac5b22f75364d47b4a2330827d970417c5c716d
|
File details
Details for the file cs.py.stack-20220918-py3-none-any.whl.
File metadata
- Download URL: cs.py.stack-20220918-py3-none-any.whl
- Upload date:
- Size: 3.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.9.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
dbe13e786120c092b70976af843a13adf62e1c449649be358b20c447e53d1eec
|
|
| MD5 |
03506e34bbcf47b8bfcc1be42885a2ec
|
|
| BLAKE2b-256 |
30b970fa487bd0ee5d1699683d760e5d673e6474871bff566512b60fc7a892b1
|