Hi,

the buffer API changed in Py3b3, without updating the PEP. The reasoning
behind the changes were discussed in full length here:

http://bugs.python.org/issue3139

Here's an incomplete patch that updates the struct, but that's definitely not
enough, so I hope that Dag finds some time to fix things up.

Let's hope that this is a) really the last beta (at least Guido is pretty
determined to make it that) and b) the last major change to the buffer protocol.

Stefan
diff -r 90e24d236a55 Cython/Compiler/Buffer.py
--- a/Cython/Compiler/Buffer.py	Fri Aug 22 21:09:02 2008 +0200
+++ b/Cython/Compiler/Buffer.py	Fri Aug 22 21:30:33 2008 +0200
@@ -626,7 +626,7 @@ def use_py2_buffer_functions(env):
         static void __Pyx_ReleaseBuffer(PyObject *obj, Py_buffer *view);
         #else
         #define __Pyx_GetBuffer PyObject_GetBuffer
-        #define __Pyx_ReleaseBuffer PyObject_ReleaseBuffer
+        #define __Pyx_ReleaseBuffer(a,b) PyBuffer_Release(b)
         #endif
     """), code], codename)
 
diff -r 90e24d236a55 Cython/Compiler/Builtin.py
--- a/Cython/Compiler/Builtin.py	Fri Aug 22 21:09:02 2008 +0200
+++ b/Cython/Compiler/Builtin.py	Fri Aug 22 21:30:33 2008 +0200
@@ -104,14 +104,15 @@ builtin_structs_table = [
 builtin_structs_table = [
     ('Py_buffer', 'Py_buffer',
      [("buf",        PyrexTypes.c_void_ptr_type),
+      ("obj",        PyrexTypes.c_void_ptr_type),
       ("len",        PyrexTypes.c_py_ssize_t_type),
+      ("itemsize",   PyrexTypes.c_py_ssize_t_type),
       ("readonly",   PyrexTypes.c_bint_type),
+      ("ndim",       PyrexTypes.c_int_type),
       ("format",     PyrexTypes.c_char_ptr_type),
-      ("ndim",       PyrexTypes.c_int_type),
       ("shape",      PyrexTypes.c_py_ssize_t_ptr_type),
       ("strides",    PyrexTypes.c_py_ssize_t_ptr_type),
       ("suboffsets", PyrexTypes.c_py_ssize_t_ptr_type),
-      ("itemsize",   PyrexTypes.c_py_ssize_t_type),
       ("internal",   PyrexTypes.c_void_ptr_type),
       ])
 ]
diff -r 90e24d236a55 Cython/Compiler/ModuleNode.py
--- a/Cython/Compiler/ModuleNode.py	Fri Aug 22 21:09:02 2008 +0200
+++ b/Cython/Compiler/ModuleNode.py	Fri Aug 22 21:30:33 2008 +0200
@@ -429,14 +429,15 @@ class ModuleNode(Nodes.Node, Nodes.Block
         code.putln("")
         code.putln("  typedef struct {")
         code.putln("     void *buf;")
+        code.putln("     PyObject *obj;")
         code.putln("     Py_ssize_t len;")
+        code.putln("     Py_ssize_t itemsize;")
         code.putln("     int readonly;")
+        code.putln("     int ndim;")
         code.putln("     const char *format;")
-        code.putln("     int ndim;")
         code.putln("     Py_ssize_t *shape;")
         code.putln("     Py_ssize_t *strides;")
         code.putln("     Py_ssize_t *suboffsets;")
-        code.putln("     Py_ssize_t itemsize;")
         code.putln("     void *internal;")
         code.putln("  } Py_buffer;")
         code.putln("")
_______________________________________________
Cython-dev mailing list
[email protected]
http://codespeak.net/mailman/listinfo/cython-dev

Reply via email to