Commit 35efaff7 authored by Lisandro Dalcin's avatar Lisandro Dalcin

fix reference leak in the capi export function, add testcase

parent 5c76095c
...@@ -2128,6 +2128,7 @@ static int __Pyx_ExportFunction(const char *name, void *f, const char *sig) { ...@@ -2128,6 +2128,7 @@ static int __Pyx_ExportFunction(const char *name, void *f, const char *sig) {
goto bad; goto bad;
if (PyDict_SetItemString(d, name, p) < 0) if (PyDict_SetItemString(d, name, p) < 0)
goto bad; goto bad;
Py_DECREF(p);
Py_DECREF(d); Py_DECREF(d);
return 0; return 0;
bad: bad:
......
__doc__ = u"""
>>> import sys
>>> sys.getrefcount(Foo.__pyx_vtable__)
2
>>> sys.getrefcount(__pyx_capi__['spam'])
2
"""
cdef public api class Foo [type FooType, object FooObject]:
cdef void bar(self):
pass
cdef api void spam():
pass
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