Commit adbe80ea authored by Vitja Makarov's avatar Vitja Makarov

Disallow deletion of C global variables

parent ab3434c3
......@@ -4848,7 +4848,8 @@ class DelStatNode(StatNode):
arg = self.args[i] = arg.analyse_target_expression(env, None)
if arg.type.is_pyobject or (arg.is_name and
arg.type.is_memoryviewslice):
pass
if arg.is_name and arg.entry.is_cglobal:
error(arg.pos, "Deletion of global C variable")
elif arg.type.is_ptr and arg.type.base_type.is_cpp_class:
self.cpp_check(env)
elif arg.type.is_cpp_class:
......
......@@ -19,6 +19,9 @@ def outer(a):
del a
return inner()
cdef object g
del g
_ERRORS = u"""
10:9: Cannot assign to or delete this
......@@ -26,4 +29,5 @@ _ERRORS = u"""
13:9: Deletion of non-Python, non-C++ object
14:9: Deletion of non-Python, non-C++ object
19:9: can not delete variable 'a' referenced in nested scope
23:5: Deletion of global C variable
"""
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment