summary refs log tree commit diff
path: root/synapse/logging/utils.py
diff options
context:
space:
mode:
authorAndrew Morgan <andrew@amorgan.xyz>2020-02-26 12:12:14 +0000
committerAndrew Morgan <andrew@amorgan.xyz>2020-02-26 12:12:14 +0000
commitfba32b84d28fd6018b698f5ee6738ad29347b216 (patch)
tree221d296c5c0764fc1720e29e4ea160e509fb2bda /synapse/logging/utils.py
parentFix yields and copy instead of move push rules on room upgrade (#6144) (diff)
parentFix up some typechecking (#6150) (diff)
downloadsynapse-fba32b84d28fd6018b698f5ee6738ad29347b216.tar.xz
Fix up some typechecking (#6150)
Diffstat (limited to 'synapse/logging/utils.py')
-rw-r--r--synapse/logging/utils.py20
1 files changed, 16 insertions, 4 deletions
diff --git a/synapse/logging/utils.py b/synapse/logging/utils.py

index 7df0fa6087..6073fc2725 100644 --- a/synapse/logging/utils.py +++ b/synapse/logging/utils.py
@@ -119,7 +119,11 @@ def trace_function(f): logger = logging.getLogger(name) level = logging.DEBUG - s = inspect.currentframe().f_back + frame = inspect.currentframe() + if frame is None: + raise Exception("Can't get current frame!") + + s = frame.f_back to_print = [ "\t%s:%s %s. Args: args=%s, kwargs=%s" @@ -144,7 +148,7 @@ def trace_function(f): pathname=pathname, lineno=lineno, msg=msg, - args=None, + args=tuple(), exc_info=None, ) @@ -157,7 +161,12 @@ def trace_function(f): def get_previous_frames(): - s = inspect.currentframe().f_back.f_back + + frame = inspect.currentframe() + if frame is None: + raise Exception("Can't get current frame!") + + s = frame.f_back.f_back to_return = [] while s: if s.f_globals["__name__"].startswith("synapse"): @@ -174,7 +183,10 @@ def get_previous_frames(): def get_previous_frame(ignore=[]): - s = inspect.currentframe().f_back.f_back + frame = inspect.currentframe() + if frame is None: + raise Exception("Can't get current frame!") + s = frame.f_back.f_back while s: if s.f_globals["__name__"].startswith("synapse"):