[Cython] In-place division in memoryview, ndarray causes compiler error
Stefan Behnel
stefan_ml at behnel.de
Mon Aug 20 09:39:42 CEST 2012
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/7551bd228685329e4309a56939b11d3c98791ede
Stefan
More information about the cython-devel
mailing list