Commit d2fb1655 authored by scoder's avatar scoder

Merge pull request #198 from pv/bug/fused-refcount

BUG: fix reference counting bug in fused type method descriptor
parents 976d57f2 d61c005f
...@@ -598,6 +598,7 @@ static PyObject *__pyx_FusedFunction_New(PyTypeObject *type, ...@@ -598,6 +598,7 @@ static PyObject *__pyx_FusedFunction_New(PyTypeObject *type,
PyObject *qualname, PyObject *self, PyObject *module, PyObject *qualname, PyObject *self, PyObject *module,
PyObject *code); PyObject *code);
static int __pyx_FusedFunction_clear(__pyx_FusedFunctionObject *self);
static PyTypeObject *__pyx_FusedFunctionType = NULL; static PyTypeObject *__pyx_FusedFunctionType = NULL;
static int __pyx_FusedFunction_init(void); static int __pyx_FusedFunction_init(void);
...@@ -624,8 +625,7 @@ __pyx_FusedFunction_New(PyTypeObject *type, PyMethodDef *ml, int flags, ...@@ -624,8 +625,7 @@ __pyx_FusedFunction_New(PyTypeObject *type, PyMethodDef *ml, int flags,
} }
static void __pyx_FusedFunction_dealloc(__pyx_FusedFunctionObject *self) { static void __pyx_FusedFunction_dealloc(__pyx_FusedFunctionObject *self) {
Py_XDECREF(self->__signatures__); __pyx_FusedFunction_clear(self);
/* __pyx_CyFunction_dealloc((__pyx_CyFunctionObject *) m); */
__pyx_FusedFunctionType->tp_free((PyObject *) self); __pyx_FusedFunctionType->tp_free((PyObject *) self);
} }
......
...@@ -222,6 +222,18 @@ def test_normal_class(): ...@@ -222,6 +222,18 @@ def test_normal_class():
""" """
NormalClass().method[pure_cython.short](10) NormalClass().method[pure_cython.short](10)
def test_normal_class_refcount():
"""
>>> test_normal_class_refcount()
short 10
0
"""
import sys
x = NormalClass()
c = sys.getrefcount(x)
x.method[pure_cython.short](10)
print sys.getrefcount(x) - c
def test_fused_declarations(cython.integral i, cython.floating f): def test_fused_declarations(cython.integral i, cython.floating f):
""" """
>>> test_fused_declarations[pure_cython.short, pure_cython.float](5, 6.6) >>> test_fused_declarations[pure_cython.short, pure_cython.float](5, 6.6)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment