[pypy-commit] pypy reflex-support: (coding) fixes needed after having merged default

wlav noreply at buildbot.pypy.org
Mon Mar 25 19:31:44 CET 2013


Author: Wim Lavrijsen <WLavrijsen at lbl.gov>
Branch: reflex-support
Changeset: r62750:b253b799130e
Date: 2013-03-25 11:30 -0700
http://bitbucket.org/pypy/pypy/changeset/b253b799130e/

Log:	(coding) fixes needed after having merged default

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
@@ -1150,10 +1150,10 @@
     memory_regulator.register(cppinstance)
     return w_cppinstance
 
- at unwrap_spec(cppinstance=W_CPPInstance)
-def addressof(space, cppinstance):
+ at unwrap_spec(w_cppinstance=W_CPPInstance)
+def addressof(space, w_cppinstance):
     """Takes a bound C++ instance, returns the raw address."""
-    address = rffi.cast(rffi.LONG, cppinstance.get_rawobject())
+    address = rffi.cast(rffi.LONG, w_cppinstance.get_rawobject())
     return space.wrap(address)
 
 @unwrap_spec(address=int, owns=bool)
diff --git a/pypy/module/cppyy/test/advancedcpp.h b/pypy/module/cppyy/test/advancedcpp.h
--- a/pypy/module/cppyy/test/advancedcpp.h
+++ b/pypy/module/cppyy/test/advancedcpp.h
@@ -243,7 +243,9 @@
     int m_i;
 };
 
+#ifndef __CINT__
 template class std::vector<ref_tester>;
+#endif
 
 
 //===========================================================================
diff --git a/pypy/module/cppyy/test/advancedcpp_LinkDef.h b/pypy/module/cppyy/test/advancedcpp_LinkDef.h
--- a/pypy/module/cppyy/test/advancedcpp_LinkDef.h
+++ b/pypy/module/cppyy/test/advancedcpp_LinkDef.h
@@ -58,6 +58,8 @@
 #pragma link C++ class some_class_with_data;
 #pragma link C++ class some_class_with_data::some_data;
 
+#pragma link C++ class ref_tester;
+#pragma link C++ class std::vector<ref_tester>;
 #pragma link C++ class pointer_pass;
 
 #pragma link C++ class multi1;
diff --git a/pypy/module/cppyy/test/test_crossing.py b/pypy/module/cppyy/test/test_crossing.py
--- a/pypy/module/cppyy/test/test_crossing.py
+++ b/pypy/module/cppyy/test/test_crossing.py
@@ -80,7 +80,7 @@
         AppTestCpythonExtensionBase.setup_method.im_func(self, func)
 
         @unwrap_spec(name=str, init=str, body=str)
-        def load_cdll(space, name, init, body, w_symbols):
+        def create_cdll(space, name, init, body, w_symbols):
             # the following is loosely from test_cpyext.py import_module; it
             # is copied here to be able to tweak the call to
             # compile_extension_module and to get a different return result
@@ -98,13 +98,12 @@
             mod = compile_extension_module(space, name, symbols, **kwds)
 
             # explicitly load the module as a CDLL rather than as a module
-            import ctypes
             from pypy.module.imp.importing import get_so_extension
             fullmodname = os.path.join(
                 os.path.dirname(mod), name + get_so_extension(space))
-            return ctypes.CDLL(fullmodname, ctypes.RTLD_GLOBAL)
+            return space.wrap(fullmodname)
 
-        self.w_load_cdll = self.space.wrap(interp2app(load_cdll))
+        self.w_create_cdll = self.space.wrap(interp2app(create_cdll))
 
     def test00_base_class(self):
         """Test from cpyext; only here to see whether the imported class works"""
@@ -144,11 +143,10 @@
         };
         """
         # explicitly load the module as a CDLL rather than as a module
-#        dirname = space.wrap(os.path.dirname(mod))
-
-#        dirname = self.import_module(name='bar', init=init, body=body, load_it=False)
-#        fullmodname = os.path.join(dirname, name + self.soext)
-        self.cmodule = self.load_cdll(name, init, body, ['bar_unwrap', 'bar_wrap'])#ctypes.CDLL(fullmodname, ctypes.RTLD_GLOBAL)
+        import ctypes
+        self.cmodule = ctypes.CDLL(
+            self.create_cdll(name, init, body, ['bar_unwrap', 'bar_wrap']),
+            ctypes.RTLD_GLOBAL)
 
     def test02_crossing_dict(self):
         """Test availability of all needed classes in the dict"""


More information about the pypy-commit mailing list