I find the supplied python traceback facilities quite awkward. These functions provide convenient facilities.
Latest release 20220429: caller: return None if the stack index 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 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.
Release files for cs-py-stack 20220429
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| cs.py.stack-20220429.tar.gz | 3.3 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| cs.py.stack-20220429-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 6.6 kB
Release files / cs.py.stack-20220429.tar.gz
| Download URL | cs.py.stack-20220429.tar.gz |
|---|---|
| Size | 3.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ed358999dc23cc4a66121b550488726d82e137f8599ee9d2574e9cac6ee5473f
|
|
BLAKE2b-256 checksum How to use checksums |
273212ad13faa4c5a36d98072e43463befa1ca7063be4353f17679ff34790dcb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.8.0 pkginfo/1.8.1 readme-renderer/30.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.7 tqdm/4.62.3 importlib-metadata/4.8.2 keyring/23.3.0 rfc3986/1.5.0 colorama/0.4.4 CPython/3.9.12
|
Release files / cs.py.stack-20220429-py3-none-any.whl
| Download URL | cs.py.stack-20220429-py3-none-any.whl |
|---|---|
| Size | 3.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
1e91b0b88538e1f05227a2c3050ded1ead4f0368a4ae5d71774db1017fa3a20e
|
|
BLAKE2b-256 checksum How to use checksums |
419935f43cccc077c011c849dc5d7b5766e0b3ecec616db071768d96e4f0be01
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.8.0 pkginfo/1.8.1 readme-renderer/30.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.7 tqdm/4.62.3 importlib-metadata/4.8.2 keyring/23.3.0 rfc3986/1.5.0 colorama/0.4.4 CPython/3.9.12
|