type.vtabslot_cname,
struct_type_cast, type.vtabptr_cname))
for entry in py_attrs:
- if entry.name == "__weakref__":
+ if scope.is_internal or entry.name == "__weakref__":
+ # internal classes do not need None inits
code.putln("p->%s = 0;" % entry.cname)
else:
code.put_init_var_to_py_none(entry, "p->%s", nanny=False)
Naming.empty_tuple))
# TODO: error handling
code.put_gotref(Naming.cur_scope_cname)
- # The code below is because we assume the local variables are
- # innitially NULL.
# Note that it is unsafe to decref the scope at this point.
- for entry in lenv.arg_entries + lenv.var_entries:
- if entry.in_closure and entry.type.is_pyobject:
- code.put_gotref(entry.cname) # so the refnanny doesn't whine
- code.put_var_decref_clear(entry)
if env.is_closure_scope:
- if lenv.is_closure_scope:
- code.put_gotref(outer_scope_cname)
- code.put_decref(outer_scope_cname, env.scope_class.type)
code.putln("%s = (%s)%s;" % (
outer_scope_cname,
env.scope_class.type.declaration_code(''),
pos = node.pos, defining = True, implementing = True)
func_scope.scope_class = entry
class_scope = entry.type.scope
+ class_scope.is_internal = True
if node.entry.scope.is_closure_scope:
class_scope.declare_var(pos=node.pos,
name=Naming.outer_scope_cname, # this could conflict?
# return_type PyrexType or None Return type of function owning scope
# is_py_class_scope boolean Is a Python class scope
# is_c_class_scope boolean Is an extension type scope
+ # is_closure_scope boolean
# scope_prefix string Disambiguator for C names
# in_cinclude boolean Suppress C declaration code
# qualified_name string "modname" or "modname.classname"
# nogil boolean In a nogil section
# directives dict Helper variable for the recursive
# analysis, contains directive values.
+ # is_internal boolean Is only used internally (simpler setup)
is_py_class_scope = 0
is_c_class_scope = 0
is_closure_scope = 0
is_module_scope = 0
+ is_internal = 0
scope_prefix = ""
in_cinclude = 0
nogil = 0