[pypy-commit] pypy cppyy-packaging: anotator fixes

wlav pypy.commits at gmail.com
Fri Jul 13 02:16:57 EDT 2018


Author: Wim Lavrijsen <WLavrijsen at lbl.gov>
Branch: cppyy-packaging
Changeset: r94858:0a2cbe7fb341
Date: 2018-07-12 22:56 -0700
http://bitbucket.org/pypy/pypy/changeset/0a2cbe7fb341/

Log:	anotator fixes

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
@@ -109,7 +109,7 @@
 
     def _wrap_reference(self, space, rffiptr):
         if self.do_assign:
-            rffiptr[0] = self._unwrap_object(space, self.w_item)
+            rffiptr[0] = rffi.cast(self.c_type, self._unwrap_object(space, self.w_item))
         self.do_assign = False
         return self._wrap_object(space, rffiptr[0])    # all paths, for rtyper
 
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
@@ -594,8 +594,10 @@
         sig = '(%s)' % signature
         for f in self.functions:
             if f.signature(False) == sig:
-                return type(self)(self.space, self.scope, [f])
-        raise oefmt(self.space.w_LookupError, "signature \"%s\" not found" % signature)
+                if isinstance(self, W_CPPStaticOverload):
+                    return W_CPPStaticOverload(self.space, self.scope, [f])
+                return W_CPPOverload(self.space, self.scope, [f])
+        raise oefmt(self.space.w_LookupError, "signature '%s' not found", signature)
 
     # allow user to determine ffi use rules per overload
     def fget_useffi(self, space):
@@ -870,7 +872,6 @@
     __getitem__  = interp2app(W_CPPTemplateOverload.getitem),
     __call__     = interp2app(W_CPPTemplateOverload.call_args),
     __useffi__   = GetSetProperty(W_CPPTemplateOverload.fget_useffi, W_CPPTemplateOverload.fset_useffi),
-    __overload__ = interp2app(W_CPPTemplateOverload.mp_overload),
     __doc__      = GetSetProperty(W_CPPTemplateOverload.fget_doc)
 )
 
@@ -929,7 +930,6 @@
     __getitem__  = interp2app(W_CPPTemplateStaticOverload.getitem),
     __call__     = interp2app(W_CPPTemplateStaticOverload.call_args),
     __useffi__   = GetSetProperty(W_CPPTemplateStaticOverload.fget_useffi, W_CPPTemplateStaticOverload.fset_useffi),
-    __overload__ = interp2app(W_CPPTemplateStaticOverload.mp_overload),
     __doc__      = GetSetProperty(W_CPPTemplateStaticOverload.fget_doc)
 )
 
@@ -1103,7 +1103,9 @@
         sig = '(%s)' % signature
         for f in overload.functions:
             if f.signature(False) == sig:
-                return type(overload)(self.space, self, [f])
+                if isinstance(overload, W_CPPStaticOverload):
+                    return W_CPPStaticOverload(self.space, self, [f])
+                return W_CPPOverload(self.space, self, [f])
         raise oefmt(self.space.w_LookupError, "no overload matches signature")
 
     def __eq__(self, other):


More information about the pypy-commit mailing list