Commit be7f5fd9 authored by Vitja Makarov's avatar Vitja Makarov

Completely remove init_to_none attribute

parent 931b8d94
......@@ -1290,10 +1290,7 @@ class CCodeWriter(object):
def put_var_decref(self, entry):
if entry.type.is_pyobject:
if entry.init_to_none:
self.putln("__Pyx_DECREF(%s);" % self.entry_as_pyobject(entry))
else:
self.putln("__Pyx_XDECREF(%s);" % self.entry_as_pyobject(entry))
self.putln("__Pyx_XDECREF(%s);" % self.entry_as_pyobject(entry))
def put_var_decref_clear(self, entry):
if entry.type.is_pyobject:
......
......@@ -1416,10 +1416,6 @@ class FuncDefNode(StatNode, BlockNode):
if entry.type.is_pyobject:
if (acquire_gil or entry.assignments) and not entry.in_closure:
code.put_var_incref(entry)
# ----- Initialise local variables
for entry in lenv.var_entries:
if entry.type.is_pyobject and entry.init_to_none and entry.used:
code.put_init_var_to_py_none(entry)
# ----- Initialise local buffer auxiliary variables
for entry in lenv.var_entries + lenv.arg_entries:
if entry.type.is_buffer and entry.buffer_aux.buffer_info_var.used:
......@@ -2264,7 +2260,6 @@ class DefNode(FuncDefNode):
arg.entry = env.declare_var(arg.name, arg.type, arg.pos)
if arg.type.is_pyobject:
arg.entry.init = "0"
arg.entry.init_to_none = 0
else:
arg.entry = self.declare_argument(env, arg)
arg.entry.used = 1
......@@ -2285,7 +2280,6 @@ class DefNode(FuncDefNode):
entry = env.declare_var(arg.name, type, arg.pos)
entry.used = 1
entry.init = "0"
entry.init_to_none = 0
entry.xdecref_cleanup = 1
arg.entry = entry
env.control_flow.set_state((), (arg.name, 'initialized'), True)
......
......@@ -3294,10 +3294,6 @@ class FinalOptimizePhase(Visitor.CythonTransform):
if node.first:
lhs = node.lhs
lhs.lhs_of_first_assignment = True
if isinstance(lhs, ExprNodes.NameNode) and lhs.entry.type.is_pyobject:
# Have variable initialized to 0 rather than None
lhs.entry.init_to_none = False
lhs.entry.init = 0
return node
def visit_SimpleCallNode(self, node):
......
......@@ -1540,8 +1540,6 @@ if VALUE is not None:
type_name = entry.type.module_name + '.' + type_name
if entry.init is not None:
default_value = ' = ' + entry.init
elif entry.init_to_none:
default_value = ' = ' + repr(None)
docstring = attr_name + ': ' + type_name + default_value
property.doc = EncodedString(docstring)
# ---------------------------------------
......
......@@ -96,7 +96,6 @@ class Entry(object):
# holding its home namespace
# pymethdef_cname string PyMethodDef structure
# signature Signature Arg & return types for Python func
# init_to_none boolean True if initial value should be None
# as_variable Entry Alternative interpretation of extension
# type name or builtin C function as a variable
# xdecref_cleanup boolean Use Py_XDECREF for error cleanup
......@@ -157,7 +156,6 @@ class Entry(object):
func_cname = None
func_modifiers = []
doc = None
init_to_none = 0
as_variable = None
xdecref_cleanup = 0
in_cinclude = 0
......@@ -1390,7 +1388,6 @@ class LocalScope(Scope):
api=api, in_pxd=in_pxd, is_cdef=is_cdef)
if type.is_pyobject and not Options.init_local_none:
entry.init = "0"
entry.init_to_none = False
entry.is_local = 1
entry.in_with_gil_block = self._in_with_gil_block
......
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