Ticket #666 (new defect)

Opened 3 years ago

compiler crash on nested templates

Reported by: hoytak Owned by: somebody
Priority: major Milestone: wishlist
Component: Parsing Keywords:
Cc:

Description

Attempting to compile/parse nested templates crashes cython. For example:

cdef extern from "test.h":

    cdef cppclass bar[T]:
        pass

    cdef cppclass foo[T]:
        pass

foo[bar[int]]()

Compiling the last line there causes cython to crash with traceback

Traceback (most recent call last):
  File "/home/hoytak/sysroot/bin/cython", line 8, in <module>
    main(command_line = 1)
  File "/home/hoytak/sysroot/lib/python2.6/site-packages/Cython/Compiler/Main.py", line 814, in main
    result = compile(sources, options)
  File "/home/hoytak/sysroot/lib/python2.6/site-packages/Cython/Compiler/Main.py", line 789, in compile
    return compile_multiple(source, options)
  File "/home/hoytak/sysroot/lib/python2.6/site-packages/Cython/Compiler/Main.py", line 761, in compile_multiple
    result = run_pipeline(source, options)
  File "/home/hoytak/sysroot/lib/python2.6/site-packages/Cython/Compiler/Main.py", line 625, in run_pipeline
    err, enddata = context.run_pipeline(pipeline, source)
  File "/home/hoytak/sysroot/lib/python2.6/site-packages/Cython/Compiler/Main.py", line 244, in run_pipeline
    data = phase(data)
  File "Visitor.py", line 272, in Cython.Compiler.Visitor.CythonTransform.__call__ (Cython/Compiler/Visitor.c:4940)
  File "Visitor.py", line 255, in Cython.Compiler.Visitor.VisitorTransform.__call__ (Cython/Compiler/Visitor.c:4700)
  File "Visitor.py", line 163, in Cython.Compiler.Visitor.TreeVisitor._visit (Cython/Compiler/Visitor.c:3258)
  File "/home/hoytak/sysroot/lib/python2.6/site-packages/Cython/Compiler/ParseTreeTransforms.py", line 1271, in visit_ModuleNode
    node.body.analyse_expressions(node.scope)
  File "/home/hoytak/sysroot/lib/python2.6/site-packages/Cython/Compiler/Nodes.py", line 351, in analyse_expressions
    stat.analyse_expressions(env)
  File "/home/hoytak/sysroot/lib/python2.6/site-packages/Cython/Compiler/Nodes.py", line 3368, in analyse_expressions
    self.expr.analyse_expressions(env)
  File "/home/hoytak/sysroot/lib/python2.6/site-packages/Cython/Compiler/ExprNodes.py", line 322, in analyse_expressions
    self.analyse_types(env)
  File "/home/hoytak/sysroot/lib/python2.6/site-packages/Cython/Compiler/ExprNodes.py", line 2888, in analyse_types
    if self.analyse_as_type_constructor(env):
  File "/home/hoytak/sysroot/lib/python2.6/site-packages/Cython/Compiler/ExprNodes.py", line 2797, in analyse_as_type_constructor
    self.function = RawCNameExprNode(self.function.pos, constructor.type)
AttributeError: 'NoneType' object has no attribute 'type'

Thanks!

Note: See TracTickets for help on using tickets.