I can cythonize this code:
def test():
sentinal = '3'
with open('foo.txt', 'w') as f:
sentinal == '1' or sentinal == '2'
or this:
def test():
sentinal = '3'
with open('foo.txt', 'w') as f:
pass
sentinal in ('1', '2')
but not this:
def test():
sentinal = '3'
with open('foo.txt', 'w') as f:
sentinal in ('1', '2')
$ cython test_open.pyx
Error converting Pyrex file to C:
------------------------------------------------------------
...
def test():
sentinal = '3'
with open('foo.txt', 'w') as f:
^
------------------------------------------------------------
/Users/darren/temp/test/test_open.pyx:3:4: Compiler crash in
AnalyseExpressionsTransform
ModuleNode.body = StatListNode(test_open.pyx:1:0)
StatListNode.stats[0] = DefNode(test_open.pyx:1:0,
modifiers = [...]/0,
name = 'test',
reqd_kw_flags_cname = '0')
File 'Nodes.py', line 343, in analyse_expressions:
StatListNode(test_open.pyx:2:4)
File 'Nodes.py', line 343, in analyse_expressions:
StatListNode(test_open.pyx:3:4)
File 'Nodes.py', line 4914, in analyse_expressions:
TryFinallyStatNode(test_open.pyx:3:4,
preserve_exception = 1)
File 'Nodes.py', line 343, in analyse_expressions:
StatListNode(test_open.pyx:3:4)
File 'Nodes.py', line 4608, in analyse_expressions:
TryExceptStatNode(test_open.pyx:3:4)
File 'Nodes.py', line 343, in analyse_expressions:
StatListNode(test_open.pyx:3:4)
File 'Nodes.py', line 343, in analyse_expressions:
StatListNode(test_open.pyx:3:4)
File 'Nodes.py', line 3243, in analyse_expressions:
ExprStatNode(test_open.pyx:3:4)
File 'ExprNodes.py', line 308, in analyse_expressions:
EvalWithTempExprNode(test_open.pyx:3:4,
use_managed_ref = True)
File 'UtilNodes.py', line 239, in analyse_types:
EvalWithTempExprNode(test_open.pyx:3:4,
use_managed_ref = True)
File 'ExprNodes.py', line 5664, in analyse_types:
BoolBinopNode(test_open.pyx:3:4,
operator = 'or',
use_managed_ref = True)
File 'ExprNodes.py', line 4892, in analyse_types:
TypecastNode(test_open.pyx:3:4,
use_managed_ref = True)
File 'ExprNodes.py', line 6138, in analyse_types:
PrimaryCmpNode(test_open.pyx:3:4,
operator = '==',
use_managed_ref = True)
File 'ExprNodes.py', line 5840, in is_cpp_comparison:
PrimaryCmpNode(test_open.pyx:3:4,
operator = '==',
use_managed_ref = True)
Compiler crash traceback from this point on:
File
"/Users/darren/.local/lib/python3.1/site-packages/Cython/Compiler/ExprNodes.py",
line 5841, in is_cpp_comparison
return self.operand1.type.is_cpp_class or self.operand2.type.is_cpp_class
AttributeError: 'NoneType' object has no attribute 'is_cpp_class'
_______________________________________________
Cython-dev mailing list
[email protected]
http://codespeak.net/mailman/listinfo/cython-dev