This commit is contained in:
2026-05-19 08:04:15 -06:00
parent c2549cf3cc
commit 6533df2173

View File

@@ -1554,7 +1554,8 @@ class PGLogger(bdb.Bdb):
for n in node.names: for n in node.names:
all_modules_to_preimport.append(n.name) all_modules_to_preimport.append(n.name)
elif isinstance(node, ast.ImportFrom): elif isinstance(node, ast.ImportFrom):
all_modules_to_preimport(node.module) if node.module:
all_modules_to_preimport.append(node.module)
for m in all_modules_to_preimport: for m in all_modules_to_preimport:
if ( if (
@@ -1704,12 +1705,10 @@ class PGLogger(bdb.Bdb):
res = self.trace res = self.trace
# if the SECOND to last entry is an 'exception' # remove the final 'return' from <module> — it's a bdb artifact that
# and the last entry is return from <module>, then axe the last # fires when the script finishes, not a user-visible step
# entry, for aesthetic reasons :)
if ( if (
len(res) >= 2 len(res) >= 1
and res[-2]["event"] == "exception"
and res[-1]["event"] == "return" and res[-1]["event"] == "return"
and res[-1]["func_name"] == "<module>" and res[-1]["func_name"] == "<module>"
): ):
@@ -1809,4 +1808,5 @@ def exec_script_str_local(
except bdb.BdbQuit: except bdb.BdbQuit:
pass pass
finally: finally:
return logger.finalize() result = logger.finalize()
return result