58
59def _make_binop(op: str) -> t.Callable[["CodeGenerator", nodes.BinExpr, "Frame"], None]:
60 @optimizeconst
61 def visitor(self: "CodeGenerator", node: nodes.BinExpr, frame: Frame) -> None: 62 if (
63 self.environment.sandboxed
64 and op in self.environment.intercepted_binops # type: ignore
This local variable name is being used before it is defined. This will throw an UnboundLocalError
.
It is recommended to refactor this code.
def used_before_assignment(a):
if x == a: # x is defined in the next line
for x in [1, 2]:
pass
def correct_usage(a):
for x in [1, 2]:
if x == a:
pass