Re: [cython-users] Regression in "cdef readonly" attribute when bindings directive became enabled by default

111 views
Skip to first unread message

Robert Bradshaw

unread,
Sep 12, 2012, 8:31:19 AM9/12/12
to cython...@googlegroups.com
On Wed, Sep 12, 2012 at 4:40 AM, Gunnlaugur Þór Briem
<gunnl...@gmail.com> wrote:
> Hi,
>
> I just tried building my project with cython 0.17 and hit a compiler crash.
> The Trac at http://trac.cython.org/cython_trac/ is down with a proxy error,
> so the error report is coming here. :)
>
> The project was building fine with bleeding-edge cython from github three
> weeks ago, so this is a recent regression.
>
> Per git bisect the regression occurs at
> https://github.com/cython/cython/commit/621dbe64038979c5cee22553c9a6710f36467b67
> in which the 'binding' directive was enabled by default
>
> Sure enough, if I run with cython -Xbinding=False the build completes just
> fine.
>
> This binding directive is not documented anywhere, it seems, and I haven't
> dived into the code to figure out what this means.
>
> Minimal case to reproduce the failure:

Thanks for the report! The interaction with binding here is certainly a bug.

>
> foo.py:
> ========
> class Bar(object):
> pass
>
> foo.pxd:
> ========
> cdef class Bar(object):
> cdef readonly object foo
>
> $ cython foo.py
>
> Error compiling Cython file:
> ------------------------------------------------------------
> ...
> class Bar(object):
> ^
> ------------------------------------------------------------
>
> foo.py:1:0: Compiler crash in AnalyseDeclarationsTransform
>
> ModuleNode.body = StatListNode(foo.py:1:0)
> StatListNode.stats[0] = CClassDefNode(foo.py:1:0,
> class_name = u'Bar',
> visibility = 'private')
>
> Compiler crash traceback from this point on:
> File "Visitor.py", line 178, in
> Cython.Compiler.Visitor.TreeVisitor._visitchild
> (/Users/gthb/extsvn/cython/Cython/Compiler/Visitor.c:3937)
> File
> "/Users/gthb/pyenv/CYTEST/lib/python2.7/site-packages/Cython/Compiler/ParseTreeTransforms.py",
> line 1438, in visit_CClassDefNode
> self.visit(property)
> File "Visitor.py", line 157, in Cython.Compiler.Visitor.TreeVisitor.visit
> (/Users/gthb/extsvn/cython/Cython/Compiler/Visitor.c:3581)
> File "Visitor.py", line 158, in Cython.Compiler.Visitor.TreeVisitor.visit
> (/Users/gthb/extsvn/cython/Cython/Compiler/Visitor.c:3533)
> File "Visitor.py", line 167, in Cython.Compiler.Visitor.TreeVisitor._visit
> (/Users/gthb/extsvn/cython/Cython/Compiler/Visitor.c:3733)
> File "Visitor.py", line 288, in
> Cython.Compiler.Visitor.CythonTransform.visit_Node
> (/Users/gthb/extsvn/cython/Cython/Compiler/Visitor.c:5792)
> File "Visitor.py", line 240, in
> Cython.Compiler.Visitor.VisitorTransform.visitchildren
> (/Users/gthb/extsvn/cython/Cython/Compiler/Visitor.c:4850)
> File "Visitor.py", line 214, in
> Cython.Compiler.Visitor.TreeVisitor._visitchildren
> (/Users/gthb/extsvn/cython/Cython/Compiler/Visitor.c:4627)
> AssertionError: Cannot insert list here: body in <class
> 'Cython.Compiler.Nodes.PropertyNode'>(pos=(<FileSourceDescriptor:/Users/gthb/extsvn/cython/foo.pxd>,
> 2, 25)):
> childretval: [<class
> 'Cython.Compiler.Nodes.DefNode'>(pos=(<FileSourceDescriptor:/Users/gthb/extsvn/cython/foo.pxd>,
> 2, 25)), <class
> 'Cython.Compiler.Nodes.SingleAssignmentNode'>(pos=(<FileSourceDescriptor:/Users/gthb/extsvn/cython/foo.pxd>,
> 2, 25))]
> child: <class
> 'Cython.Compiler.Nodes.DefNode'>(pos=(<FileSourceDescriptor:/Users/gthb/extsvn/cython/foo.pxd>,
> 2, 25))
> self: <Cython.Compiler.ParseTreeTransforms.AnalyseDeclarationsTransform
> object at 0x105cc4870>
>
> The error does not come up when I change the declaration to "cdef public" or
> just "cdef", only "cdef readonly" fails this way.
>
> Regards,
>
> Gulli
>
Reply all
Reply to author
Forward
0 new messages