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
diff -r b75ae05c8584 Cython/Compiler/Parsing.py
--- a/Cython/Compiler/Parsing.py Mon Jan 21 07:50:23 2013 +0100
+++ b/Cython/Compiler/Parsing.py Mon Jan 21 08:21:40 2013 +0100
@@ -2982,7 +2982,8 @@
s.next() # 'property'
name = p_ident(s)
doc, body = p_suite(s, Ctx(level = 'property'), with_doc = 1)
- return Nodes.PropertyNode(pos, name = name, doc = doc, body = body)
+ return Nodes.PropertyNode(pos, name = name, doc = doc,
+ body = Nodes.StatListNode(pos, stats=[body]))
def p_doc_string(s):
if s.sy == 'BEGIN_STRING':
_______________________________________________
cython-devel mailing list
[email protected]
http://mail.python.org/mailman/listinfo/cython-devel