only provide a fake PyObject_GetBuffer in Py2.5 and earlier
authorStefan Behnel <scoder@users.berlios.de>
Fri, 11 Jul 2008 14:40:28 +0000 (16:40 +0200)
committerStefan Behnel <scoder@users.berlios.de>
Fri, 11 Jul 2008 14:40:28 +0000 (16:40 +0200)
Cython/Compiler/ModuleNode.py

index 20237b8eaa2a233708ab2f7b7f3af1eede3cc797..3dbdf90db8b9a93be421064bc1543ea4239afbe7 100644 (file)
@@ -2010,6 +2010,7 @@ static void numpy_releasebuffer(PyObject *obj, Py_buffer *view) {
             types.append((ndarrtype.typeptr_cname, "numpy_getbuffer", "numpy_releasebuffer"))
         except KeyError:
             pass
+        code.putln("#if PY_VERSION_HEX < 0x02060000")
         code.putln("static int PyObject_GetBuffer(PyObject *obj, Py_buffer *view, int flags) {")
         if len(types) > 0:
             clause = "if"
@@ -2030,6 +2031,7 @@ static void numpy_releasebuffer(PyObject *obj, Py_buffer *view) {
                 clause = "else if"
         code.putln("}")
         code.putln("")
+        code.putln("#endif")
 
 
 #------------------------------------------------------------------------------------