[pypy-commit] pypy reflex-support: compare to a cast 0 instead of relying on implicit null

wlav noreply at buildbot.pypy.org
Sun Apr 21 03:53:26 CEST 2013


Author: Wim Lavrijsen <WLavrijsen at lbl.gov>
Branch: reflex-support
Changeset: r63537:42bcb364d381
Date: 2013-04-19 15:30 -0700
http://bitbucket.org/pypy/pypy/changeset/42bcb364d381/

Log:	compare to a cast 0 instead of relying on implicit null

diff --git a/pypy/module/cppyy/executor.py b/pypy/module/cppyy/executor.py
--- a/pypy/module/cppyy/executor.py
+++ b/pypy/module/cppyy/executor.py
@@ -132,10 +132,10 @@
     def execute(self, space, cppmethod, cppthis, num_args, args):
         lresult = capi.c_call_l(space, cppmethod, cppthis, num_args, args)
         ccpresult = rffi.cast(rffi.CCHARP, lresult)
-        if ccpresult:
-            result = rffi.charp2str(ccpresult)  # TODO: make it a choice to free
-            return space.wrap(result)
-        return space.wrap('')
+        if ccpresult == rffi.cast(rffi.CCHARP, 0):
+            return space.wrap("")
+        result = rffi.charp2str(ccpresult)   # TODO: make it a choice to free
+        return space.wrap(result)
 
 
 class ConstructorExecutor(FunctionExecutor):


More information about the pypy-commit mailing list