Returns (module, locals) of the function `depth` frames away from the caller
(depth=0)
| 87 | #def debugx(expr,pre_msg=''): pass |
| 88 | |
| 89 | def extract_module_locals(depth=0): |
| 90 | """Returns (module, locals) of the function `depth` frames away from the caller""" |
| 91 | f = sys._getframe(depth + 1) |
| 92 | global_ns = f.f_globals |
| 93 | module = sys.modules[global_ns['__name__']] |
| 94 | return (module, f.f_locals) |