From 309e3a2d634a71aa03beb349adc03e26d26d5fea Mon Sep 17 00:00:00 2001 From: Robert Bradshaw Date: Wed, 13 Aug 2008 00:07:55 -0700 Subject: [PATCH] Minor fixes for bufaccess. --- Cython/Compiler/ParseTreeTransforms.py | 2 +- Cython/Includes/python_ref.pxd | 4 +++- tests/run/bufaccess.pyx | 6 +++--- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/Cython/Compiler/ParseTreeTransforms.py b/Cython/Compiler/ParseTreeTransforms.py index 28403909..b6bb6509 100644 --- a/Cython/Compiler/ParseTreeTransforms.py +++ b/Cython/Compiler/ParseTreeTransforms.py @@ -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) diff --git a/Cython/Includes/python_ref.pxd b/Cython/Includes/python_ref.pxd index a0ec12bc..e9b17411 100644 --- a/Cython/Includes/python_ref.pxd +++ b/Cython/Includes/python_ref.pxd @@ -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 diff --git a/tests/run/bufaccess.pyx b/tests/run/bufaccess.pyx index 45050fcb..b1917404 100644 --- a/tests/run/bufaccess.pyx +++ b/tests/run/bufaccess.pyx @@ -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 (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]), (buf[i]).ob_refcnt @testcase def assign_to_object(object[object] buf, int idx, obj): -- 2.26.2