Skip to content

Commit cc668dc

Browse files
committed
jlib: fix unsupported operand type when setting log level
This fixes the following issue when log_levels_find() is used (for example when setting a log level delta using JLIB_log_levels): [...] scripts/jlib.py:424:log(): level += log_levels_find( caller) scripts/jlib.py:334:log_levels_find(): tb = traceback.extract_stack( None, 1+caller) TypeError: unsupported operand type(s) for +: 'int' and 'FrameInfo' Note that this fix get JLIB_log_levels working, but it might be incorrect. Signed-off-by: Raphaël Mélotte <[email protected]>
1 parent 157f3e5 commit cc668dc

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

scripts/jlib.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -331,7 +331,11 @@ def log_levels_find( caller):
331331
if not s_log_levels_items:
332332
return 0
333333

334-
tb = traceback.extract_stack( None, 1+caller)
334+
if isinstance(caller, inspect.FrameInfo):
335+
tb = traceback.extract_stack( None, 1)
336+
else:
337+
tb = traceback.extract_stack( None, 1+caller)
338+
335339
if len(tb) == 0:
336340
return 0
337341
filename, line, function, text = tb[0]

0 commit comments

Comments
 (0)