Commit ed4b0e7b authored by Dag Sverre Seljebotn's avatar Dag Sverre Seljebotn

Raise compilation error on object[object] inplace operators (which are buggy)

parent 2f022483
...@@ -2532,7 +2532,10 @@ class InPlaceAssignmentNode(AssignmentNode): ...@@ -2532,7 +2532,10 @@ class InPlaceAssignmentNode(AssignmentNode):
extra = ", Py_None" extra = ", Py_None"
else: else:
extra = "" extra = ""
import ExprNodes
if self.lhs.type.is_pyobject: if self.lhs.type.is_pyobject:
if isinstance(self.lhs, ExprNodes.IndexNode) and self.lhs.is_buffer_access:
error(self.pos, "In-place operators not allowed on object buffers in this release.")
self.dup.generate_result_code(code) self.dup.generate_result_code(code)
code.putln( code.putln(
"%s = %s(%s, %s%s); %s" % ( "%s = %s(%s, %s%s); %s" % (
...@@ -2556,7 +2559,6 @@ class InPlaceAssignmentNode(AssignmentNode): ...@@ -2556,7 +2559,6 @@ class InPlaceAssignmentNode(AssignmentNode):
else: else:
error(self.pos, "No C inplace power operator") error(self.pos, "No C inplace power operator")
# have to do assignment directly to avoid side-effects # have to do assignment directly to avoid side-effects
import ExprNodes
if isinstance(self.lhs, ExprNodes.IndexNode) and self.lhs.is_buffer_access: if isinstance(self.lhs, ExprNodes.IndexNode) and self.lhs.is_buffer_access:
self.lhs.generate_buffer_setitem_code(self.rhs, code, c_op) self.lhs.generate_buffer_setitem_code(self.rhs, code, c_op)
else: else:
......
...@@ -102,3 +102,22 @@ cdef extern from "numpy/arrayobject.h": ...@@ -102,3 +102,22 @@ cdef extern from "numpy/arrayobject.h":
ctypedef float npy_float96 ctypedef float npy_float96
ctypedef float npy_float128 ctypedef float npy_float128
ctypedef npy_int8 int8_t
ctypedef npy_int16 int16_t
ctypedef npy_int32 int32_t
ctypedef npy_int64 int64_t
ctypedef npy_int96 int96_t
ctypedef npy_int128 int128_t
ctypedef npy_uint8 uint8_t
ctypedef npy_uint16 uint16_t
ctypedef npy_uint32 uint32_t
ctypedef npy_uint64 uint64_t
ctypedef npy_uint96 uint96_t
ctypedef npy_uint128 uint128_t
ctypedef npy_float32 float32_t
ctypedef npy_float64 float64_t
ctypedef npy_float80 float80_t
ctypedef npy_float128 float128_t
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment