robertwb / issues-import-test

0 stars 0 forks source link

Cannot use "except" with complex numbers #102

Open robertwb opened 7 years ago

robertwb commented 7 years ago

Reported by jdemeyer on 23 Sep 2015 09:35 UTC The following code

cdef extern:
    double complex foo() except -1.0

gives

analyse_types not implemented
Called from: CoerceToComplexNode.not_implemented 398
Called from: CoerceToComplexNode.analyse_types 596
Called from: CoerceToComplexNode.analyse_const_expression 511
Called from: CFuncDeclaratorNode.analyse 717
Called from: CVarDefNode.analyse_declarations 1314
Called from: StatListNode.analyse_declarations 425
Called from: ModuleNode.analyse_declarations 103
Called from: AnalyseDeclarationsTransform.visit_ModuleNode 1458
Called from: AnalyseDeclarationsTransform._visit 183
Called from: AnalyseDeclarationsTransform.__call__ 272
Called from: AnalyseDeclarationsTransform.__call__ 289
Called from: AnalyseDeclarationsTransform.__call__ 341
Called from: AnalyseDeclarationsTransform.__call__ 1450
Called from: run_pipeline 365
Called from: run_pipeline 487
Called from: compile_multiple 657
Called from: compile 679
Called from: main 704
Called from: setuptools_main 687
Called from: <module> 9
----------------------------------------------------------------------

Error compiling Cython file:
------------------------------------------------------------
...
cdef extern:
    double complex foo() except -1.0
                               ^
------------------------------------------------------------

complextest.pyx:2:32: Compiler crash in AnalyseDeclarationsTransform

File 'ModuleNode.py', line 103, in analyse_declarations: ModuleNode(complextest.pyx:1:0,
    full_module_name = 'complextest')
File 'Nodes.py', line 425, in analyse_declarations: StatListNode(complextest.pyx:2:4)
File 'Nodes.py', line 1314, in analyse_declarations: CVarDefNode(complextest.pyx:2:4,
    modifiers = [...]/0,
    visibility = u'extern')
File 'Nodes.py', line 717, in analyse: CFuncDeclaratorNode(complextest.pyx:2:22,
    calling_convention = '')
File 'ExprNodes.py', line 511, in analyse_const_expression: CoerceToComplexNode(complextest.pyx:2:32,
    result_is_used = True,
    use_managed_ref = True)
File 'ExprNodes.py', line 596, in analyse_types: CoerceToComplexNode(complextest.pyx:2:32,
    result_is_used = True,
    use_managed_ref = True)
File 'ExprNodes.py', line 401, in not_implemented: CoerceToComplexNode(complextest.pyx:2:32,
    result_is_used = True,
    use_managed_ref = True)

Compiler crash traceback from this point on:
  File "/usr/local/src/sage-git/local/lib/python2.7/site-packages/Cython-0.24.0a0-py2.7.egg/Cython/Compiler/ExprNodes.py", line 401, in not_implemented
    (self.__class__.__name__, method_name))
InternalError: Internal compiler error: CoerceToComplexNode.analyse_types not implemented

Migrated-From: http://trac.cython.org/ticket/869