Minor fixes for bufaccess.
authorRobert Bradshaw <robertwb@math.washington.edu>
Wed, 13 Aug 2008 07:07:55 +0000 (00:07 -0700)
committerRobert Bradshaw <robertwb@math.washington.edu>
Wed, 13 Aug 2008 07:07:55 +0000 (00:07 -0700)
Cython/Compiler/ParseTreeTransforms.py
Cython/Includes/python_ref.pxd
tests/run/bufaccess.pyx

index 2840390931abffccb962e21bb80d11d08c186001..b6bb65098c29279a9a7bee8efd26ca326b30d62c 100644 (file)
@@ -359,7 +359,7 @@ class ResolveOptions(CythonTransform):
             for option in options:
                 name, value = option
                 optdict[name] = value
-            return self.visit_with_options(node, options)
+            return self.visit_with_options(node, optdict)
         else:
             return self.visit_Node(node)
                                    
index a0ec12bce0a67b43def670d6bff81f9703414c11..e9b17411a49a63946eca1de1465db5bbe9c1ed69 100644 (file)
@@ -1,6 +1,8 @@
 cdef extern from "Python.h":
-    ctypedef void PyObject
     ctypedef void PyTypeObject
+    ctypedef struct PyObject:
+        Py_ssize_t ob_refcnt
+        PyTypeObject *ob_type
     ctypedef struct FILE    
 
 
index 45050fcb4d7031ed106220f603a154a44cb612ce..b19174042cb3ce0ebbbcb9bc3d432d7680e72858 100644 (file)
@@ -14,7 +14,7 @@ cimport python_buffer
 cimport stdio
 cimport cython
 
-cimport refcount
+from python_ref cimport PyObject
 
 __test__ = {}
 setup_string = """
@@ -719,7 +719,7 @@ def decref(*args):
     for item in args: Py_DECREF(item)
 
 def get_refcount(x):
-    return refcount.CyTest_GetRefcount(x)
+    return (<PyObject*>x).ob_refcnt
 
 @testcase
 def printbuf_object(object[object] buf, shape):
@@ -742,7 +742,7 @@ def printbuf_object(object[object] buf, shape):
     """
     cdef int i
     for i in range(shape[0]):
-        print repr(buf[i]), refcount.CyTest_GetRefcount(buf[i])
+        print repr(buf[i]), (<PyObject*>buf[i]).ob_refcnt
 
 @testcase
 def assign_to_object(object[object] buf, int idx, obj):