[pypy-svn] r74200 - pypy/branch/cpython-extension/pypy/module/cpyext

afa at codespeak.net afa at codespeak.net
Wed Apr 28 23:01:23 CEST 2010


Author: afa
Date: Wed Apr 28 23:01:21 2010
New Revision: 74200

Modified:
   pypy/branch/cpython-extension/pypy/module/cpyext/api.py
   pypy/branch/cpython-extension/pypy/module/cpyext/pyobject.py
Log:
Oops, fix test: add_borrowed_object must be called to reset "state.last_container"


Modified: pypy/branch/cpython-extension/pypy/module/cpyext/api.py
==============================================================================
--- pypy/branch/cpython-extension/pypy/module/cpyext/api.py	(original)
+++ pypy/branch/cpython-extension/pypy/module/cpyext/api.py	Wed Apr 28 23:01:21 2010
@@ -442,7 +442,7 @@
                     retval = make_ref(space, result, borrowed=borrowed)
                 else:
                     retval = result
-                if borrowed and retval:
+                if borrowed:
                     add_borrowed_object(space, retval)
             elif callable.api_func.restype is not lltype.Void:
                 retval = rffi.cast(callable.api_func.restype, result)

Modified: pypy/branch/cpython-extension/pypy/module/cpyext/pyobject.py
==============================================================================
--- pypy/branch/cpython-extension/pypy/module/cpyext/pyobject.py	(original)
+++ pypy/branch/cpython-extension/pypy/module/cpyext/pyobject.py	Wed Apr 28 23:01:21 2010
@@ -305,6 +305,8 @@
     state = space.fromcache(State)
     container_ptr = state.last_container
     state.last_container = 0
+    if not obj:
+        return
     if not container_ptr:
         raise NullPointerException
     if container_ptr == -1:



More information about the Pypy-commit mailing list