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

@@ -232,8 +232,7 @@ def main(tags, *,
block_count=None,
off=None,
**args):
import builtins
list_, list = list, builtins.list
list_ = list; del list
# list all known tags
if list_: