[pypy-commit] pypy reflex-support: rpython fixes

wlav noreply at buildbot.pypy.org
Tue Jun 7 02:54:03 CEST 2011


Author: Wim Lavrijsen <WLavrijsen at lbl.gov>
Branch: reflex-support
Changeset: r44764:1f43c8895333
Date: 2011-06-06 17:54 -0700
http://bitbucket.org/pypy/pypy/changeset/1f43c8895333/

Log:	rpython 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
@@ -1,4 +1,7 @@
 import sys
+
+from pypy.interpreter.error import OperationError
+
 from pypy.rpython.lltypesystem import rffi, lltype
 from pypy.rlib import libffi
 
diff --git a/pypy/module/cppyy/helper.py b/pypy/module/cppyy/helper.py
--- a/pypy/module/cppyy/helper.py
+++ b/pypy/module/cppyy/helper.py
@@ -2,15 +2,18 @@
 
 
 #- type name manipulations --------------------------------------------------
+def _remove_const(name):
+    return "".join(rstring.split(name, "const")) # poor man's replace
+
 def compound(name):
-    name = "".join(rstring.split(name, "const")) # poor man's replace
+    name = _remove_const(name)
     if name.endswith("]"):                       # array type?
         return "[]"
     i = _find_qualifier_index(name)
     return "".join(name[i:].split(" "))
 
 def array_size(name):
-    name = "".join(rstring.split(name, "const")) # poor man's replace
+    name = _remove_const(name)
     if name.endswith("]"):                       # array type?
         idx = name.rfind("[")
         if 0 < idx:
@@ -40,10 +43,11 @@
              name = name[:idx]
     elif name.endswith(">"):                     # template type?
         idx = name.find("<")
-        n1 = "".join(rstring.split(name[:idx], "const")) # poor man's replace
-        name = "".join((n1, name[idx:]))
+        if 0 < idx:      # always true, but just so that the translater knows
+            n1 = _remove_const(name[:idx])
+            name = "".join([n1, name[idx:]])
     else:
-        name = "".join(rstring.split(name, "const")) # poor man's replace
+        name = _remove_const(name)
         name = name[:_find_qualifier_index(name)]
     return name.strip(' ')
 


More information about the pypy-commit mailing list