Commit 0b133e00 authored by Vitja Makarov's avatar Vitja Makarov

Don't add vars that can't be coerced to PyObject into locals() dict

parent cd32184f
......@@ -6726,7 +6726,9 @@ class GlobalsExprNode(AtomicExprNode):
class FuncLocalsExprNode(DictNode):
def __init__(self, pos, env):
local_vars = [var.name for var in env.entries.values() if var.name]
local_vars = [entry.name for entry in env.entries.values()
if entry.name and (entry.type is unspecified_type or
entry.type.can_coerce_to_pyobject(env))]
items = [DictItemNode(pos, key=IdentifierStringNode(pos, value=var),
value=NameNode(pos, name=var, allow_null=True))
for var in local_vars]
......
......@@ -71,3 +71,11 @@ def sorted(it):
l = list(it)
l.sort()
return l
def locals_ctype():
"""
>>> locals_ctype()
False
"""
cdef int *p = NULL
return 'p' in locals()
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