If I try to compile the following with the current master version:
def buggy(int N, double[:] x):
x[0, N-1]
I get a crash. This only seems to happen when too many indices are used,
and at least one of them is an expression involving a variable (for
example, things like x[0, N] and x[0, 2-1] don't cause crashes). Here is
the full output (this probably isn't related, but I'm also a bit confused
about all these "non-trivial type declarators" warnings, which keep
appearing in code I thought was working correctly):
warning: View.MemoryView:410:43: Non-trivial type declarators in shared
declaration.
warning: View.MemoryView:583:32: Non-trivial type declarators in shared
declaration.
warning: View.MemoryView:588:32: Non-trivial type declarators in shared
declaration.
warning: View.MemoryView:1020:20: Non-trivial type declarators in shared
declaration.
warning: View.MemoryView:1020:28: Non-trivial type declarators in shared
declaration.
warning: View.MemoryView:1020:38: Non-trivial type declarators in shared
declaration.
Error compiling Cython file:
--
--
...
def buggy(int N, double[:] x):
x[0, N-1]
^
bug.pyx:2:10: Too many indices specified for type double[:]
Error compiling Cython file:
...
def buggy(int N, double[:] x):
x[0, N-1]
^
bug.pyx:2:10: Compiler crash in OptimizeBuiltinCalls
ModuleNode.body = StatListNode(bug.pyx:1:0)
StatListNode.stats[0] = DefNode(bug.pyx:1:0,
modifiers = [...]/0,
name = 'buggy',
num_required_args = 2,
py_wrapper_required = True,
reqd_kw_flags_cname = '0',
used = True)
DefNode.body = StatListNode(bug.pyx:2:5)
StatListNode.stats[0] = ExprStatNode(bug.pyx:2:5)
ExprStatNode.expr = IndexNode(bug.pyx:2:5,
use_managed_ref = True)
IndexNode.index = TupleNode(bug.pyx:2:5,
is_sequence_constructor = 1,
result_is_used = True,
use_managed_ref = True)
TupleNode.args[1] = SubNode(bug.pyx:2:10,
infix = True,
operator = '-',
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
(/home/.../cython/Cython/Compiler/Visitor.c:4122)
File "Visitor.py", line 505, in
Cython.Compiler.Visitor.MethodDispatcherTransform.visit_BinopNode
(/home/.../cython/Cython/Compiler/Visitor.c:9459)
File "Visitor.py", line 516, in
Cython.Compiler.Visitor.MethodDispatcherTransform._visit_binop_node
(/home/.../cython/Cython/Compiler/Visitor.c:9613)
AttributeError: 'NoneType' object has no attribute 'is_builtin_type'
___
cython-devel mailing list
cython-devel@python.org
https://mail.python.org/mailman/listinfo/cython-devel