Skip to content

Commit e5edfa5

Browse files
author
Christopher Doris
committed
remove del on variables from py macro since it is unsafe
1 parent e9175d5 commit e5edfa5

File tree

1 file changed

+2
-10
lines changed

1 file changed

+2
-10
lines changed

src/py_macro.jl

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -449,16 +449,8 @@ function py_macro_lower(st, body, ans, ex; flavour=:expr)
449449

450450
for arg in args
451451

452-
# @del x
453-
if arg isa Symbol
454-
if arg in BUILTINS
455-
py_macro_err(st, ex, "can't delete a builtin")
456-
else
457-
push!(body, :($pydel!($arg::$Py)))
458-
end
459-
460452
# @del x.k
461-
elseif isexpr(arg, :.)
453+
if isexpr(arg, :.)
462454
ax, ak = ex.args
463455
@gensym x k
464456
tx = py_macro_lower(st, body, x, ax)
@@ -485,7 +477,7 @@ function py_macro_lower(st, body, ans, ex; flavour=:expr)
485477
py_macro_del(body, k, tk)
486478

487479
else
488-
py_macro_err(st, ex, "@del argument must be a variable, reference or property")
480+
py_macro_err(st, ex, "@del argument must be an attribute or indexing expression")
489481
end
490482
end
491483
py_macro_assign(body, ans, nothing)

0 commit comments

Comments
 (0)