提交 c78d9413 authored 作者: Arnaud Bergeron's avatar Arnaud Bergeron

Fix code in reply to comments:

- add an explanatory comment - remove useless code
上级 a8868a17
......@@ -865,12 +865,17 @@ CLazyLinker_call(PyObject *_self, PyObject *args, PyObject *kwds)
}
}
/*
Clear everything that is left and not an output. This is needed
for lazy evaluation since the current GC algo is too conservative
with lazy graphs.
*/
if (self->allow_gc && !err)
{
for (Py_ssize_t i = 0; i < self->n_vars; ++i)
{
int do_cleanup = 1;
if (!self->var_has_owner[i])
if (!self->var_has_owner[i] || !self->var_computed[i])
continue;
for (int j = 0; j < self->n_output_vars; ++j)
{
......@@ -882,22 +887,8 @@ CLazyLinker_call(PyObject *_self, PyObject *args, PyObject *kwds)
}
if (!do_cleanup)
continue;
for (int j = 0; j < self->n_updates; ++j)
{
break;
if (i == self->update_storage[2*j])
{
do_cleanup = 0;
break;
}
}
if (!do_cleanup)
continue;
Py_INCREF(Py_None);
PyList_SetItem(self->var_value_cells[i], 0, Py_None);
self->var_computed[i] = 0;
Py_INCREF(zero);
PyList_SetItem(self->var_computed_cells[i], 0, zero);
}
}
Py_DECREF(one);
......@@ -981,7 +972,7 @@ static PyTypeObject lazylinker_ext_CLazyLinkerType = {
static PyObject * get_version(PyObject *dummy, PyObject *args)
{
PyObject *result = PyFloat_FromDouble(0.16);
PyObject *result = PyFloat_FromDouble(0.17);
return result;
}
......
......@@ -13,7 +13,7 @@ if config.compiledir not in sys.path:
sys.path.append(config.compiledir)
force_compile = False
version = 0.16 # must match constant returned in function get_version()
version = 0.17 # must match constant returned in function get_version()
try:
......
......@@ -410,7 +410,6 @@ class Stack(VM):
for v in storage_map:
if v.owner and not v in self.outputs:
storage_map[v][0] = None
compute_map[v][0] = 0
try:
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论