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

afa at codespeak.net afa at codespeak.net
Wed Apr 28 19:50:05 CEST 2010


Author: afa
Date: Wed Apr 28 19:50:03 2010
New Revision: 74195

Modified:
   pypy/branch/cpython-extension/pypy/module/cpyext/api.py
Log:
It's not really necessary to record NULL as a borrowed reference.
This also fix a crash in PyDict_GetItem, which returns NULL without declaring a 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 19:50:03 2010
@@ -442,7 +442,7 @@
                     retval = make_ref(space, result, borrowed=borrowed)
                 else:
                     retval = result
-                if borrowed:
+                if borrowed and retval:
                     add_borrowed_object(space, retval)
             elif callable.api_func.restype is not lltype.Void:
                 retval = rffi.cast(callable.api_func.restype, result)



More information about the Pypy-commit mailing list