Author: mattip <[email protected]>
Branch: cpyext-ext
Changeset: r82957:1e56856d07a0
Date: 2016-03-11 12:05 +0200
http://bitbucket.org/pypy/pypy/changeset/1e56856d07a0/

Log:    ml_name and ml_doc are 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
@@ -21,10 +21,10 @@
 
 PyMethodDef = cpython_struct(
     'PyMethodDef',
-    [('ml_name', rffi.CCHARP),
+    [('ml_name', rffi.CONST_CCHARP),
      ('ml_meth', PyCFunction_typedef),
      ('ml_flags', rffi.INT_real),
-     ('ml_doc', rffi.CCHARP),
+     ('ml_doc', rffi.CONST_CCHARP),
      ])
 
 PyCFunctionObjectStruct = cpython_struct(
diff --git a/pypy/module/cpyext/typeobject.py b/pypy/module/cpyext/typeobject.py
--- a/pypy/module/cpyext/typeobject.py
+++ b/pypy/module/cpyext/typeobject.py
@@ -19,7 +19,7 @@
     Py_TPFLAGS_HAVE_GETCHARBUFFER, build_type_checkers, StaticObjectBuilder,
     PyObjectFields, Py_TPFLAGS_BASETYPE)
 from pypy.module.cpyext.methodobject import (
-    PyDescr_NewWrapper, PyCFunction_NewEx, PyCFunction_typedef)
+    PyDescr_NewWrapper, PyCFunction_NewEx, PyCFunction_typedef, PyMethodDef)
 from pypy.module.cpyext.modsupport import convert_method_defs
 from pypy.module.cpyext.pyobject import (
     PyObject, make_ref, create_ref, from_ref, get_typedescr, make_typedescr,
@@ -289,14 +289,13 @@
     state = space.fromcache(State)
     if state.new_method_def:
         return state.new_method_def
-    from pypy.module.cpyext.modsupport import PyMethodDef
     ptr = lltype.malloc(PyMethodDef, flavor="raw", zero=True,
                         immortal=True)
-    ptr.c_ml_name = rffi.str2charp("__new__")
+    ptr.c_ml_name = rffi.cast(rffi.CONST_CCHARP, rffi.str2charp("__new__"))
     lltype.render_immortal(ptr.c_ml_name)
     rffi.setintfield(ptr, 'c_ml_flags', METH_VARARGS | METH_KEYWORDS)
-    ptr.c_ml_doc = rffi.str2charp(
-        "T.__new__(S, ...) -> a new object with type S, a subtype of T")
+    ptr.c_ml_doc = rffi.cast(rffi.CONST_CCHARP, rffi.str2charp(
+        "T.__new__(S, ...) -> a new object with type S, a subtype of T"))
     lltype.render_immortal(ptr.c_ml_doc)
     state.new_method_def = ptr
     return ptr
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to