[pypy-commit] pypy cpyext-ext: charp2str does not accept const char *

mattip pypy.commits at gmail.com
Sat Mar 12 17:42:34 EST 2016


Author: mattip <matti.picus at gmail.com>
Branch: cpyext-ext
Changeset: r83005:85120bcdf24e
Date: 2016-03-13 00:41 +0200
http://bitbucket.org/pypy/pypy/changeset/85120bcdf24e/

Log:	charp2str does not accept const char *

diff --git a/pypy/module/cpyext/methodobject.py b/pypy/module/cpyext/methodobject.py
--- a/pypy/module/cpyext/methodobject.py
+++ b/pypy/module/cpyext/methodobject.py
@@ -62,7 +62,7 @@
 class W_PyCFunctionObject(W_Root):
     def __init__(self, space, ml, w_self, w_module=None):
         self.ml = ml
-        self.name = rffi.charp2str(self.ml.c_ml_name)
+        self.name = rffi.charp2str(rffi.cast(rffi.CCHARP,self.ml.c_ml_name))
         self.w_self = w_self
         self.w_module = w_module
 
@@ -108,7 +108,7 @@
     def get_doc(self, space):
         doc = self.ml.c_ml_doc
         if doc:
-            return space.wrap(rffi.charp2str(doc))
+            return space.wrap(rffi.charp2str(rffi.cast(rffi.CCHARP,doc)))
         else:
             return space.w_None
 
@@ -118,7 +118,7 @@
     def __init__(self, space, ml, w_type):
         self.space = space
         self.ml = ml
-        self.name = rffi.charp2str(ml.c_ml_name)
+        self.name = rffi.charp2str(rffi.cast(rffi.CCHARP, ml.c_ml_name))
         self.w_objclass = w_type
 
     def __repr__(self):
@@ -137,7 +137,7 @@
     def __init__(self, space, ml, w_type):
         self.space = space
         self.ml = ml
-        self.name = rffi.charp2str(ml.c_ml_name)
+        self.name = rffi.charp2str(rffi.cast(rffi.CCHARP, ml.c_ml_name))
         self.w_objclass = w_type
 
     def __repr__(self):
@@ -328,8 +328,8 @@
                 break
             if name == "__methods__":
                 method_list_w.append(
-                    space.wrap(rffi.charp2str(method.c_ml_name)))
-            elif rffi.charp2str(method.c_ml_name) == name: # XXX expensive copy
+                    space.wrap(rffi.charp2str(rffi.cast(rffi.CCHARP, method.c_ml_name))))
+            elif rffi.charp2str(rffi.cast(rffi.CCHARP, method.c_ml_name)) == name: # XXX expensive copy
                 return space.wrap(W_PyCFunctionObject(space, method, w_obj))
     if name == "__methods__":
         return space.newlist(method_list_w)
diff --git a/pypy/module/cpyext/modsupport.py b/pypy/module/cpyext/modsupport.py
--- a/pypy/module/cpyext/modsupport.py
+++ b/pypy/module/cpyext/modsupport.py
@@ -82,7 +82,7 @@
             method = methods[i]
             if not method.c_ml_name: break
 
-            methodname = rffi.charp2str(method.c_ml_name)
+            methodname = rffi.charp2str(rffi.cast(rffi.CCHARP, method.c_ml_name))
             flags = rffi.cast(lltype.Signed, method.c_ml_flags)
 
             if w_type is None:


More information about the pypy-commit mailing list