Author: Wim Lavrijsen <[email protected]>
Branch: cling-support
Changeset: r88559:29380e1248bf
Date: 2016-11-22 16:30 -0800
http://bitbucket.org/pypy/pypy/changeset/29380e1248bf/

Log:    cleanup of data member representation

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
@@ -653,8 +653,8 @@
         self.converter = converter.get_converter(self.space, type_name, '')
         self.offset = offset
 
-    def get_returntype(self):
-        return self.space.wrap(self.converter.name)
+    def is_static(self):
+        return self.space.w_False
 
     def _get_offset(self, cppinstance):
         if cppinstance:
@@ -683,13 +683,16 @@
 
 W_CPPDataMember.typedef = TypeDef(
     'CPPDataMember',
-    get_returntype = interp2app(W_CPPDataMember.get_returntype),
+    is_static = interp2app(W_CPPDataMember.is_static),
     __get__ = interp2app(W_CPPDataMember.get),
     __set__ = interp2app(W_CPPDataMember.set),
 )
 W_CPPDataMember.typedef.acceptable_as_base_class = False
 
 class W_CPPStaticData(W_CPPDataMember):
+    def is_static(self):
+        return self.space.w_True
+
     @jit.elidable_promote()
     def _get_offset(self, cppinstance):
         return self.offset
@@ -703,7 +706,7 @@
 
 W_CPPStaticData.typedef = TypeDef(
     'CPPStaticData',
-    get_returntype = interp2app(W_CPPStaticData.get_returntype),
+    is_static = interp2app(W_CPPStaticData.is_static),
     __get__ = interp2app(W_CPPStaticData.get),
     __set__ = interp2app(W_CPPStaticData.set),
 )
diff --git a/pypy/module/cppyy/pythonify.py b/pypy/module/cppyy/pythonify.py
--- a/pypy/module/cppyy/pythonify.py
+++ b/pypy/module/cppyy/pythonify.py
@@ -184,11 +184,10 @@
 
     # add all data members to the dictionary of the class to be created, and
     # static ones also to the meta class (needed for property setters)
-    import cppyy # for _is_static (FIXME)
     for name in cppclass.get_datamember_names():
         cppdm = cppclass.get_datamember(name)
         d_class[name] = cppdm
-        if cppyy._is_static(cppdm):     # TODO: make this a method of cppdm
+        if cppdm.is_static():
             d_meta[name] = cppdm
 
     # create a meta class to allow properties (for static data write access)
@@ -254,7 +253,7 @@
         try:
             cppdm = scope._cpp_proxy.get_datamember(name)
             setattr(scope, name, cppdm)
-            if cppyy._is_static(cppdm): # TODO: make this a method of cppdm
+            if cppdm.is_static():
                 setattr(scope.__class__, name, cppdm)
             pycppitem = getattr(scope, name)      # gets actual property value
         except AttributeError:
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to