[pypy-commit] pypy cpyext-gc-support-2: fix weakrefobject

arigo pypy.commits at gmail.com
Sun Feb 14 04:44:32 EST 2016


Author: Armin Rigo <arigo at tunes.org>
Branch: cpyext-gc-support-2
Changeset: r82229:cba976d16588
Date: 2016-02-14 10:43 +0100
http://bitbucket.org/pypy/pypy/changeset/cba976d16588/

Log:	fix weakrefobject

diff --git a/pypy/module/cpyext/weakrefobject.py b/pypy/module/cpyext/weakrefobject.py
--- a/pypy/module/cpyext/weakrefobject.py
+++ b/pypy/module/cpyext/weakrefobject.py
@@ -37,17 +37,19 @@
     """
     return PyWeakref_GET_OBJECT(space, w_ref)
 
- at cpython_api([PyObject], PyObject)
+ at cpython_api([PyObject], PyObject, result_borrowed=True)
 def PyWeakref_GET_OBJECT(space, w_ref):
     """Similar to PyWeakref_GetObject(), but implemented as a macro that does no
     error checking.
     """
-    return borrow_from(w_ref, space.call_function(w_ref))
+    return space.call_function(w_ref)
 
 @cpython_api([PyObject], PyObject)
 def PyWeakref_LockObject(space, w_ref):
     """Return the referenced object from a weak reference.  If the referent is
     no longer live, returns None. This function returns a new reference.
+
+    (A PyPy extension that may not be useful any more: use
+    PyWeakref_GetObject() and Py_INCREF().)
     """
     return space.call_function(w_ref)
-


More information about the pypy-commit mailing list