[pypy-commit] pypy reflex-support: resolve a conflict with _multiprocessing (both used the name handle that ended up on W_Root)

wlav noreply at buildbot.pypy.org
Thu Feb 23 01:41:40 CET 2012


Author: Wim Lavrijsen <WLavrijsen at lbl.gov>
Branch: reflex-support
Changeset: r52779:50add258af6d
Date: 2012-02-22 13:35 -0800
http://bitbucket.org/pypy/pypy/changeset/50add258af6d/

Log:	resolve a conflict with _multiprocessing (both used the name handle
	that ended up on W_Root)

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
@@ -40,6 +40,7 @@
         pass
 
     handle = capi.c_get_typehandle(name)
+    assert lltype.typeOf(handle) == capi.C_TYPEHANDLE
     if handle:
         final_name = capi.charp2str_free(capi.c_final_name(handle))
         if capi.c_is_namespace(handle):
@@ -64,6 +65,7 @@
         pass
 
     handle = capi.c_get_templatehandle(name)
+    assert lltype.typeOf(handle) == capi.C_TYPEHANDLE
     if handle:
         template = W_CPPTemplateType(space, name, handle)
         state.cpptype_cache[name] = template
@@ -239,6 +241,7 @@
         cppinstance = self.space.interp_w(W_CPPInstance, w_cppinstance, can_be_None=True)
         if cppinstance is not None:
             cppinstance._nullcheck()
+            assert isinstance(cppinstance.cppclass, W_CPPType)
             cppthis = cppinstance.cppclass.get_cppthis(cppinstance, self.scope_handle)
         else:
             cppthis = capi.C_NULL_OBJECT
@@ -287,6 +290,7 @@
     @jit.elidable_promote()
     def _get_offset(self, cppinstance):
         if cppinstance:
+            assert lltype.typeOf(cppinstance.cppclass.handle) == lltype.typeOf(self.scope_handle)
             offset = self.offset + capi.c_base_offset(
                 cppinstance.cppclass.handle, self.scope_handle, cppinstance.rawobject)
         else:
@@ -474,8 +478,8 @@
             data_member = W_CPPDataMember(self.space, self.handle, type_name, offset, is_static)
             self.data_members[data_member_name] = data_member
 
-    @jit.elidable_promote()
     def get_cppthis(self, cppinstance, scope_handle):
+        assert self.handle == cppinstance.cppclass.handle
         return cppinstance.rawobject
 
     def is_namespace(self):
@@ -505,10 +509,9 @@
 class W_ComplexCPPType(W_CPPType):
     _immutable_ = True
 
-    @jit.elidable_promote()
     def get_cppthis(self, cppinstance, scope_handle):
-        offset = capi.c_base_offset(
-            cppinstance.cppclass.handle, scope_handle, cppinstance.rawobject)
+        assert self.handle == cppinstance.cppclass.handle
+        offset = capi.c_base_offset(self.handle, scope_handle, cppinstance.rawobject)
         return capi.direct_ptradd(cppinstance.rawobject, offset)
 
 W_ComplexCPPType.typedef = TypeDef(
@@ -550,6 +553,7 @@
 
     def __init__(self, space, cppclass, rawobject, python_owns):
         self.space = space
+        assert isinstance(cppclass, W_CPPType)
         self.cppclass = cppclass
         assert lltype.typeOf(rawobject) == capi.C_OBJECT
         self.rawobject = rawobject


More information about the pypy-commit mailing list