[Cython] Compiler crash in AnalyseDeclarationsTransform with binding=True

Stefan Behnel stefan_ml at behnel.de
Mon Jan 21 08:28:29 CET 2013


Hi,

thanks for the report.

Matěj Laitl, 21.01.2013 00:16:
> Heya Cython folks,
> I face a compiler crash (full log at the bottom of the mail) with Cython 
> 0.17.1-392-g81d3d10 (today's git). This only happens if Cython directive 
> binding is left to True, if set to False, the project builds and runs fine.
> 
> Steps to reproduce:
> # git clone git://github.com/strohel/PyBayes.git
> # cd PyBayes
> # git submodule update --init
> Open support/dist_cmd_build_prepare.py, set binding to True on line 35
> # ./setup.py build
> 
> Note that this bug is not at all a recent regression - it exists at least 
> since binding=True has been made default (commit 621dbe6403) - sorry for being 
> that late reporting it.
> 
> On a related note, what does the binding directive mean? I was unable to find 
> any info at [1] or [2]. What are the consequences of disabling it to work-
> around this crash?
> 
> [1] http://wiki.cython.org/enhancements/compilerdirectives
> [2] http://docs.cython.org/src/reference/compilation.html

"Binding" is a historically grown name that means that Cython uses its own
Python function type instead of the one that CPython provides for C
functions. That allows Cython implemented functions to support binding as
methods in classes (thus the name), but generally provides them with a much
more Python-like function interface, e.g. for introspection.


> =============== Full Crash Log ===============
> running build_ext
> cythoning pybayes/filters.py to build/temp.linux-
> x86_64-2.7/pyrex/pybayes/filters.c
> 
> Error compiling Cython file:
> ------------------------------------------------------------
> ...
>     cpdef Pdf posterior(self)
>     cpdef double evidence_log(self, np.ndarray yt) except? -1
> 
> 
> cdef class KalmanFilter(Filter):
>     cdef readonly np.ndarray A, B, C, D, Q, R
>                             ^
> ------------------------------------------------------------
> 
> pybayes/filters.pxd:22:29: Compiler crash in AnalyseDeclarationsTransform
> [...]
> AssertionError: Cannot insert list here: body in 
> <Cython.Compiler.Nodes.PropertyNode object at 0x3136550>

I'm puzzled how this comes to be triggered by the "binding" directive.
Anyway, just as a stab in the dark, does the attached patch fix it for you?

Stefan

-------------- next part --------------
A non-text attachment was scrubbed...
Name: propnode_statlist.patch
Type: text/x-patch
Size: 581 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/cython-devel/attachments/20130121/7b304b43/attachment.bin>


More information about the cython-devel mailing list