[pypy-svn] r72511 - in pypy/trunk/pypy/module/cpyext: . test
xoraxax at codespeak.net
xoraxax at codespeak.net
Sun Mar 21 21:20:39 CET 2010
Author: xoraxax
Date: Sun Mar 21 21:20:37 2010
New Revision: 72511
Modified:
pypy/trunk/pypy/module/cpyext/methodobject.py
pypy/trunk/pypy/module/cpyext/test/test_cpyext.py
Log:
Sprinkle a refcnt-- into the code, looks more correct now :-)
Modified: pypy/trunk/pypy/module/cpyext/methodobject.py
==============================================================================
--- pypy/trunk/pypy/module/cpyext/methodobject.py (original)
+++ pypy/trunk/pypy/module/cpyext/methodobject.py Sun Mar 21 21:20:37 2010
@@ -26,6 +26,8 @@
w_self = self.w_self
result = self.ml.c_ml_meth(make_ref(space, w_self), make_ref(space, args_tuple))
try:
+ if result:
+ result.c_obj_refcnt -= 1
ret = from_ref(space, result)
except NullPointerException:
state = space.fromcache(State)
Modified: pypy/trunk/pypy/module/cpyext/test/test_cpyext.py
==============================================================================
--- pypy/trunk/pypy/module/cpyext/test/test_cpyext.py (original)
+++ pypy/trunk/pypy/module/cpyext/test/test_cpyext.py Sun Mar 21 21:20:37 2010
@@ -202,7 +202,7 @@
Py_DECREF(true);
refcnt_after = Py_REFCNT(true);
printf("REFCNT %i %i\\n", refcnt, refcnt_after);
- return PyBool_FromLong(refcnt_after == refcnt);
+ return PyBool_FromLong(refcnt_after == refcnt && refcnt < 3);
}
static PyMethodDef methods[] = {
{ "test_refcount", foo_pi, METH_NOARGS },
More information about the Pypy-commit
mailing list