In-place division in memoryview, ndarray causes compiler error
Hi, For this file: <file1> def div1(int[:] A): A[0] /= 1 </file1> or this one: <file2> def div2(object[int, ndim=1] A): A[0] /= 1 </file2> I get: File "/Users/mb312/usr/local/lib/python2.7/site-packages/Cython/Compiler/Nodes.py", line 354, in generate_execution_code stat.generate_execution_code(code) File "/Users/mb312/usr/local/lib/python2.7/site-packages/Cython/Compiler/Nodes.py", line 4536, in generate_execution_code if c_op in ('/', '%') and self.lhs.type.is_int and not code.directives['cdivision']: AttributeError: 'CCodeWriter' object has no attribute 'directives This is only for in-place division. I'm using current trunk: Cython version 0.17b2 Cheers, Matthew
Matthew Brett, 15.08.2012 20:38:
For this file:
<file1> def div1(int[:] A): A[0] /= 1 </file1>
or this one:
<file2> def div2(object[int, ndim=1] A): A[0] /= 1 </file2>
I get:
File "/Users/mb312/usr/local/lib/python2.7/site-packages/Cython/Compiler/Nodes.py", line 354, in generate_execution_code stat.generate_execution_code(code) File "/Users/mb312/usr/local/lib/python2.7/site-packages/Cython/Compiler/Nodes.py", line 4536, in generate_execution_code if c_op in ('/', '%') and self.lhs.type.is_int and not code.directives['cdivision']: AttributeError: 'CCodeWriter' object has no attribute 'directives
This is only for in-place division. I'm using current trunk:
Cython version 0.17b2
Thanks for the report, here is a fix: https://github.com/cython/cython/commit/7551bd228685329e4309a56939b11d3c9879... Stefan
participants (2)
-
Matthew Brett -
Stefan Behnel