joschu / cgt

Computation Graph Toolkit
Other
628 stars 87 forks source link

Native backend failed to build with Cython 0.20.1 #32

Open neocxi opened 8 years ago

neocxi commented 8 years ago

Building native backend with Cython 0.20.1 will result in Cython compiler crash:

/root/deeprl/cgt/src/cycgt.pyx:109:30: Compiler crash in CreateClosureClasses

ModuleNode.body = StatListNode(cycgt.pyx:1:0)
StatListNode.stats[16] = StatListNode(cycgt.pyx:107:5)
StatListNode.stats[0] = CFuncDefNode(cycgt.pyx:107:5,
 args = [...]/2,
 modifiers = [...]/0,
 needs_closure = True,
 visibility = u'private')
CFuncDefNode.body = StatListNode(cycgt.pyx:108:4,
 is_terminator = True)
StatListNode.stats[0] = ReturnStatNode(cycgt.pyx:109:4,
 is_terminator = True)
ReturnStatNode.value = SimpleCallNode(cycgt.pyx:109:16,
 analysed = True,
 is_temp = 1,
 result_is_used = True,
 use_managed_ref = True)
SimpleCallNode.arg_tuple = TupleNode(cycgt.pyx:109:16,
 is_sequence_constructor = 1,
 is_temp = 1,
 result_is_used = True,
 use_managed_ref = True)
TupleNode.args[0] = GeneratorExpressionNode(cycgt.pyx:109:30,
 genexpr_name = u'genexpr1',
 is_temp = 1,
 name = u'genexpr',
 needs_closure = True,
 needs_self_code = True,
 pymethdef_cname = u'__pyx_mdef_5cycgt_12cgt2py_tuple_1genexpr',
 result_is_used = True,
 use_managed_ref = True)

Compiler crash traceback from this point on:
 File "Visitor.py", line 170, in Cython.Compiler.Visitor.TreeVisitor._visit (Cython/Compiler/Visitor.c:4285)
 File "/usr/lib/python2.7/dist-packages/Cython/Compiler/ParseTreeTransforms.py", line 2364, in visit_LambdaNode
 self.create_class_from_scope(node.def_node, self.module_scope, node)
 File "/usr/lib/python2.7/dist-packages/Cython/Compiler/ParseTreeTransforms.py", line 2342, in create_class_from_scope
 type=cscope.scope_class.type,
AttributeError: 'ClosureScope' object has no attribute 'scope_class'

Maybe we can consider having a version lower bound for Cython mentioned either in Readme or checked in make tool?

hojonathanho commented 8 years ago

Good idea. For development, we pretty much use the latest version of all the dependencies, so Cython 0.23.2 should definitely work.