MCPcopy Create free account
hub / github.com/ActiveState/code / _getframe

Function _getframe

recipes/Python/52315_Obtaining_name/recipe-52315.py:12–22  ·  view source on GitHub ↗
(level=0)

Source from the content-addressed store, hash-verified

10import sys
11
12def _getframe(level=0):
13 try:
14 1/0
15 except:
16 import sys
17 tb = sys.exc_info()[-1]
18 frame = tb.tb_frame
19 while level >= 0:
20 frame = frame.f_back
21 level = level - 1
22 return frame
23
24sys._getframe = _getframe
25del _getframe

Callers 4

getrcFunction · 0.85
testedFunction · 0.85
slotsFunction · 0.85
__enter__Method · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected