scripts: Reverted del to resolve shadowed builtins
I don't know how I completely missed that this doesn't actually work! Using del _does_ work in Python's repl, but it makes sense the repl may differ from actual function execution in this case. The problem is Python still thinks the relevant builtin is a local variables after deletion, raising an UnboundLocalError instead of performing a global lookup. In theory this would work if the variable could be made global, but since global/nonlocal statements are lifted, Python complains with "SyntaxError: name 'list' is parameter and global". And that's A-Ok! Intentionally shadowing language builtins already puts this code deep into ugly hacks territory.
This commit is contained in:
+4
-2
@@ -948,7 +948,8 @@ class JumpArt:
|
||||
|
||||
@classmethod
|
||||
def fromrbyd(cls, rbyd, all=False):
|
||||
all_ = all; del all
|
||||
import builtins
|
||||
all_, all = all, builtins.all
|
||||
|
||||
jumps = []
|
||||
j_ = 4
|
||||
@@ -1100,7 +1101,8 @@ class LifetimeArt:
|
||||
|
||||
@classmethod
|
||||
def fromrbyd(cls, rbyd, all=False):
|
||||
all_ = all; del all
|
||||
import builtins
|
||||
all_, all = all, builtins.all
|
||||
|
||||
# first figure out where each rid comes from
|
||||
id = 0
|
||||
|
||||
Reference in New Issue
Block a user