[Cython] git master fails to compile scipy

Stefan Behnel stefan_ml at behnel.de
Sun Oct 11 11:32:45 EDT 2015


Julian Taylor via cython-devel schrieb am 11.10.2015 um 12:38:
> another file fails too:
> https://github.com/scipy/scipy/blob/master/scipy/sparse/csgraph/_shortest_path.pyx
> 
> Error compiling Cython file:
> ------------------------------------------------------------
> ...
>                 for k from csr_indptr[j] <= k < csr_indptr[j + 1]:
>                     w12 = csr_weights[k]
>                     ind_k = csr_indices[k]
>                     d2 = dist_matrix[i, ind_k]
>                     if d1 + w12 < d2:
>                         dist_matrix[i, ind_k] = d2 = d1 + w12
>                                                        ^
> ------------------------------------------------------------
> 
> scipy/sparse/csgraph/_shortest_path.pyx:798:56: Compiler crash in
> AnalyseExpressionsTransform
> 
> ModuleNode.body = StatListNode(_shortest_path.pyx:12:0)
> StatListNode.stats[17] = StatListNode(_shortest_path.pyx:770:5)
> StatListNode.stats[0] = CFuncDefNode(_shortest_path.pyx:770:5,
>     args = [...]/6,
>     modifiers = [...]/0,
>     visibility = u'private')
> File 'Nodes.py', line 430, in analyse_expressions:
> StatListNode(_shortest_path.pyx:777:4,
>     is_terminator = True)
> File 'Nodes.py', line 6370, in analyse_expressions:
> ForFromStatNode(_shortest_path.pyx:786:4,
>     relation1 = u'<=',
>     relation2 = u'<')
> File 'Nodes.py', line 430, in analyse_expressions:
> StatListNode(_shortest_path.pyx:787:8)
> File 'Nodes.py', line 6370, in analyse_expressions:
> ForFromStatNode(_shortest_path.pyx:790:8,
>     relation1 = u'<=',
>     relation2 = u'<')
> File 'Nodes.py', line 430, in analyse_expressions:
> StatListNode(_shortest_path.pyx:791:12)
> File 'Nodes.py', line 6370, in analyse_expressions:
> ForFromStatNode(_shortest_path.pyx:791:12,
>     relation1 = u'<=',
>     relation2 = u'<')
> File 'Nodes.py', line 430, in analyse_expressions:
> StatListNode(_shortest_path.pyx:792:16)
> File 'Nodes.py', line 6370, in analyse_expressions:
> ForFromStatNode(_shortest_path.pyx:793:16,
>     relation1 = u'<=',
>     relation2 = u'<')
> File 'Nodes.py', line 430, in analyse_expressions:
> StatListNode(_shortest_path.pyx:794:20)
> File 'Nodes.py', line 5853, in analyse_expressions:
> IfStatNode(_shortest_path.pyx:797:20)
> File 'Nodes.py', line 5899, in analyse_expressions:
> IfClauseNode(_shortest_path.pyx:797:23)
> File 'Nodes.py', line 430, in analyse_expressions:
> StatListNode(_shortest_path.pyx:798:24)
> File 'Nodes.py', line 4787, in analyse_expressions:
> CascadedAssignmentNode(_shortest_path.pyx:798:56,
>     assignment_overloads = [...]/0)
> File 'Nodes.py', line 5157, in analyse_types:
> CascadedAssignmentNode(_shortest_path.pyx:798:56,
>     assignment_overloads = [...]/0)
> 
> Compiler crash traceback from this point on:
>   File
> "/tmp/local/lib/python2.7/site-packages/Cython-0.24.0a0-py2.7-linux-x86_64.egg/Cython/Compiler/Nodes.py",
> line 5157, in analyse_types
>     overloaded = lhs.type.is_cpp_class and env.lookup_operator('=',
> [lhs, self.rhs])
> AttributeError: 'NoneType' object has no attribute 'is_cpp_class'

Thanks, here's a fix:

https://github.com/cython/cython/commit/ec1c92ee169e014cc12e5f3ef99d5ec0150d3228

There was a major refactoring in the latest master that cleaned up all the
convoluted indexing and buffer/memoryview access code that piled up over
the years. I'm not too surprised that I missed a few places and broke some
code along the way. Thanks for testing.

Stefan



More information about the cython-devel mailing list