[pypy-commit] pypy reflex-support: make jit/codewriter/jtransform.py happy

wlav noreply at buildbot.pypy.org
Tue Jun 26 21:15:59 CEST 2012


Author: Wim Lavrijsen <WLavrijsen at lbl.gov>
Branch: reflex-support
Changeset: r55844:d02e109130f5
Date: 2012-06-26 11:11 -0700
http://bitbucket.org/pypy/pypy/changeset/d02e109130f5/

Log:	make jit/codewriter/jtransform.py happy

diff --git a/pypy/module/cppyy/capi/__init__.py b/pypy/module/cppyy/capi/__init__.py
--- a/pypy/module/cppyy/capi/__init__.py
+++ b/pypy/module/cppyy/capi/__init__.py
@@ -346,7 +346,6 @@
     [C_SCOPE, C_SCOPE, rffi.CCHARP], WLAVC_INDEX,
     threadsafe=ts_reflect,
     compilation_info=backend.eci)
- at jit.elidable_promote()                      # TODO: this is debatable
 def c_get_global_operator(lc, rc, op):
     return _c_get_global_operator(lc.handle, rc.handle, op)
 
diff --git a/pypy/module/cppyy/converter.py b/pypy/module/cppyy/converter.py
--- a/pypy/module/cppyy/converter.py
+++ b/pypy/module/cppyy/converter.py
@@ -136,9 +136,11 @@
         self.size = sys.maxint
 
     def convert_argument(self, space, w_obj, address, call_local):
-        tc = space.str_w(space.getattr(w_obj, space.wrap('typecode')))
-        if self.typecode != tc:
-            msg = "expected %s pointer type, but received %s" % (self.typecode, tc)
+        w_tc = space.findattr(w_obj, space.wrap('typecode'))
+        if w_tc is None:
+            raise OperationError(space.w_TypeError, space.wrap("can not determine buffer type"))
+        if space.str_w(w_tc) != self.typecode:
+            msg = "expected %s pointer type, but received %s" % (self.typecode, space.str_w(w_tc))
             raise OperationError(space.w_TypeError, space.wrap(msg))
         x = rffi.cast(rffi.LONGP, address)
         buf = space.buffer_w(w_obj)
diff --git a/pypy/module/cppyy/interp_cppyy.py b/pypy/module/cppyy/interp_cppyy.py
--- a/pypy/module/cppyy/interp_cppyy.py
+++ b/pypy/module/cppyy/interp_cppyy.py
@@ -785,7 +785,7 @@
 
 def wrap_cppobject_nocast(space, w_pycppclass, cppclass, rawobject, isref, python_owns):
     obj = memory_regulator.retrieve(rawobject)
-    if not (obj is None) and obj.cppclass is cppclass:
+    if obj is not None and obj.cppclass is cppclass:
         return obj
     return wrap_new_cppobject_nocast(space, w_pycppclass, cppclass, rawobject, isref, python_owns)
 


More information about the pypy-commit mailing list