scripts: Adopted del to resolve shadowed builtins

So:

  all_ = all; del all

Instead of:

  import builtins
  all_, all = all, builtins.all

The del exposes the globally scoped builtin we accidentally shadow.

This requires less megic, and no module imports, though tbh I'm
surprised it works.

It also works in the case where you change a builtin globally, but
that's a bit too crazy even for me...
This commit is contained in:
Christopher Haster
2025-03-31 15:40:17 -05:00
parent 8324786121
commit 270230a833
13 changed files with 21 additions and 41 deletions

View File

@@ -607,8 +607,7 @@ def table(Result, results, diff_results=None, *,
small_table=False,
summary=False,
**_):
import builtins
all_, all = all, builtins.all
all_ = all; del all
if by is None:
by = Result._by