Raise compilation error on object[object] inplace operators (which are buggy)
authorDag Sverre Seljebotn <dagss@student.matnat.uio.no>
Fri, 15 Aug 2008 22:18:55 +0000 (00:18 +0200)
committerDag Sverre Seljebotn <dagss@student.matnat.uio.no>
Fri, 15 Aug 2008 22:18:55 +0000 (00:18 +0200)
Cython/Compiler/Nodes.py
Cython/Includes/numpy.pxd

index a9d5786d5ebfddc8396de95521b0c6a14f841442..7705997bb5b3ed4198578f6423ae563075b323fe 100644 (file)
@@ -2532,7 +2532,10 @@ class InPlaceAssignmentNode(AssignmentNode):
             extra = ", Py_None"
         else:
             extra = ""
+        import ExprNodes
         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)
             code.putln(
                 "%s = %s(%s, %s%s); %s" % (
@@ -2556,7 +2559,6 @@ class InPlaceAssignmentNode(AssignmentNode):
                 else:
                     error(self.pos, "No C inplace power operator")
             # have to do assignment directly to avoid side-effects
-            import ExprNodes
             if isinstance(self.lhs, ExprNodes.IndexNode) and self.lhs.is_buffer_access:
                 self.lhs.generate_buffer_setitem_code(self.rhs, code, c_op)
             else:
index 7f3659676beae52062cb73d71fd3c760aacbea7d..97bb303751865845c95dd8e75fa25d118bfb3599 100644 (file)
@@ -102,3 +102,22 @@ cdef extern from "numpy/arrayobject.h":
     ctypedef float        npy_float96
     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