Author: Ronan Lamy <ronan.l...@gmail.com>
Branch: rffi-parser-2
Changeset: r89624:ca94f56f64e0
Date: 2017-01-17 01:46 +0000
http://bitbucket.org/pypy/pypy/changeset/ca94f56f64e0/

Log:    Define tp_name and tp_doc as const char*

diff --git a/pypy/module/cpyext/parse/cpyext_object.h 
b/pypy/module/cpyext/parse/cpyext_object.h
--- a/pypy/module/cpyext/parse/cpyext_object.h
+++ b/pypy/module/cpyext/parse/cpyext_object.h
@@ -226,7 +226,7 @@
 
 typedef struct _typeobject {
        PyObject_VAR_HEAD
-       /* const */ char *tp_name; /* For printing, in format "<module>.<name>" 
*/
+       const char *tp_name; /* For printing, in format "<module>.<name>" */
        Py_ssize_t tp_basicsize, tp_itemsize; /* For allocation */
 
        /* Methods to implement standard operations */
@@ -258,7 +258,7 @@
        /* Flags to define presence of optional/expanded features */
        long tp_flags;
 
-       /*const*/ char *tp_doc; /* Documentation string */
+       const char *tp_doc; /* Documentation string */
 
        /* Assigned meaning in release 2.0 */
        /* call function for all accessible objects */
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
@@ -732,9 +732,10 @@
         heaptype = cts.cast('PyHeapTypeObject*', pto)
         heaptype.c_ht_name = make_ref(space, w_typename)
         from pypy.module.cpyext.bytesobject import PyString_AsString
-        pto.c_tp_name = PyString_AsString(space, heaptype.c_ht_name)
+        pto.c_tp_name = cts.cast('const char *',
+            PyString_AsString(space, heaptype.c_ht_name))
     else:
-        pto.c_tp_name = rffi.str2charp(w_type.name)
+        pto.c_tp_name = cts.cast('const char*', rffi.str2charp(w_type.name))
     # uninitialized fields:
     # c_tp_print
     # XXX implement
_______________________________________________
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to