[pypy-commit] pypy reflex-support: translation fixes
wlav
noreply at buildbot.pypy.org
Tue Aug 16 02:44:51 CEST 2011
Author: Wim Lavrijsen <WLavrijsen at lbl.gov>
Branch: reflex-support
Changeset: r46527:e905f7933a3e
Date: 2011-08-15 17:51 -0700
http://bitbucket.org/pypy/pypy/changeset/e905f7933a3e/
Log: translation fixes
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
@@ -14,10 +14,10 @@
def get_rawobject(space, w_obj):
from pypy.module.cppyy.interp_cppyy import W_CPPInstance
- cpp_instance = space.interp_w(W_CPPInstance, w_obj, can_be_None=True)
- if cpp_instance:
- assert lltype.typeOf(cpp_instance.rawobject) == rffi.VOIDP
- return cpp_instance.rawobject
+ cppinstance = space.interp_w(W_CPPInstance, w_obj, can_be_None=True)
+ if cppinstance:
+ assert lltype.typeOf(cppinstance.rawobject) == rffi.VOIDP
+ return cppinstance.rawobject
return lltype.nullptr(rffi.VOIDP.TO)
def _direct_ptradd(ptr, offset):
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
@@ -281,7 +281,7 @@
class W_CPPDataMember(Wrappable):
- _immutable_fields_ = ["scope", "converter", "offset", "_is_static"]
+ _immutable_fields_ = ["scope_handle", "converter", "offset", "_is_static"]
def __init__(self, space, scope, type_name, offset, is_static):
self.space = space
@@ -298,9 +298,10 @@
@jit.elidable_promote()
def _get_offset(self, w_cppinstance):
- if self.space.is_true(w_cppinstance):
+ cppinstance = self.space.interp_w(W_CPPInstance, w_cppinstance, can_be_None=True)
+ if cppinstance:
offset = self.offset + capi.c_base_offset(
- w_cppinstance.cppclass.handle, self.scope_handle, w_cppinstance.rawobject)
+ cppinstance.cppclass.handle, self.scope_handle, cppinstance.rawobject)
else:
offset = self.offset
return offset
@@ -514,7 +515,6 @@
self.rawobject = rawobject
self.python_owns = python_owns
-
def _nullcheck(self):
if not self.rawobject:
raise OperationError(self.space.w_ReferenceError,
@@ -532,13 +532,13 @@
W_CPPInstance.typedef = TypeDef(
'CPPInstance',
- cppclass = interp_attrproperty('cppclass', W_CPPInstance),
+ cppclass = interp_attrproperty('cppclass', cls=W_CPPInstance),
destruct = interp2app(W_CPPInstance.destruct, unwrap_spec=['self']),
)
W_CPPInstance.typedef.acceptable_as_base_class = True
def new_instance(space, w_type, cpptype, rawptr, owns):
- w_instance = space.allocate_instance(W_CPPInstance, w_type)
- instance = space.interp_w(W_CPPInstance, w_instance)
- W_CPPInstance.__init__(instance, space, cpptype, rawptr, owns)
- return w_instance
+ w_cppinstance = space.allocate_instance(W_CPPInstance, w_type)
+ cppinstance = space.interp_w(W_CPPInstance, w_cppinstance, can_be_None=False)
+ W_CPPInstance.__init__(cppinstance, space, cpptype, rawptr, owns)
+ return w_cppinstance
More information about the pypy-commit
mailing list