Commit 00d3bbf2 authored by Stefan Behnel's avatar Stefan Behnel

Adapt some non-const C-API declarations that were already constified in Py2.5.

parent 327267f2
......@@ -52,7 +52,7 @@ cdef extern from "Python.h":
# be hashable; if it isn't, TypeError will be raised. Return 0 on
# success or -1 on failure.
int PyDict_SetItemString(object p, char *key, object val) except -1
int PyDict_SetItemString(object p, const char *key, object val) except -1
# Insert value into the dictionary p using key as a key. key
# should be a char*. The key object is created using
# PyString_FromString(key). Return 0 on success or -1 on failure.
......@@ -62,7 +62,7 @@ cdef extern from "Python.h":
# hashable; if it isn't, TypeError is raised. Return 0 on success
# or -1 on failure.
int PyDict_DelItemString(object p, char *key) except -1
int PyDict_DelItemString(object p, const char *key) except -1
# Remove the entry in dictionary p which has a key specified by
# the string key. Return 0 on success or -1 on failure.
......@@ -72,7 +72,7 @@ cdef extern from "Python.h":
# NULL if the key key is not present, but without setting an
# exception.
PyObject* PyDict_GetItemString(object p, char *key)
PyObject* PyDict_GetItemString(object p, const char *key)
# Return value: Borrowed reference.
# This is the same as PyDict_GetItem(), but key is specified as a
# char*, rather than a PyObject*.
......
......@@ -6,7 +6,7 @@ cdef extern from "Python.h":
#####################################################################
# 5.3 Importing Modules
#####################################################################
object PyImport_ImportModule(char *name)
object PyImport_ImportModule(const char *name)
# Return value: New reference.
# This is a simplified interface to PyImport_ImportModuleEx()
# below, leaving the globals and locals arguments set to
......@@ -20,7 +20,7 @@ cdef extern from "Python.h":
# loaded.) Return a new reference to the imported module, or NULL
# with an exception set on failure.
object PyImport_ImportModuleEx(char *name, object globals, object locals, object fromlist)
object PyImport_ImportModuleEx(const char *name, object globals, object locals, object fromlist)
# Return value: New reference.
# Import a module. This is best described by referring to the
......@@ -64,7 +64,7 @@ cdef extern from "Python.h":
# the reloaded module, or NULL with an exception set on failure
# (the module still exists in this case).
PyObject* PyImport_AddModule(char *name) except NULL
PyObject* PyImport_AddModule(const char *name) except NULL
# Return value: Borrowed reference.
# Return the module object corresponding to a module name. The
# name argument may be of the form package.module. First check the
......@@ -145,7 +145,7 @@ cdef extern from "Python.h":
bint PyModule_CheckExact(object p)
# Return true if p is a module object, but not a subtype of PyModule_Type.
object PyModule_New(char *name)
object PyModule_New(const char *name)
# Return value: New reference.
# Return a new module object with the __name__ attribute set to
# name. Only the module's __doc__ and __name__ attributes are
......@@ -170,18 +170,18 @@ cdef extern from "Python.h":
# module's __file__ attribute. If this is not defined, or if it is
# not a string, raise SystemError and return NULL.
int PyModule_AddObject(object module, char *name, object value) except -1
int PyModule_AddObject(object module, const char *name, object value) except -1
# Add an object to module as name. This is a convenience function
# which can be used from the module's initialization
# function. This steals a reference to value. Return -1 on error,
# 0 on success.
int PyModule_AddIntConstant(object module, char *name, long value) except -1
int PyModule_AddIntConstant(object module, const char *name, long value) except -1
# Add an integer constant to module as name. This convenience
# function can be used from the module's initialization
# function. Return -1 on error, 0 on success.
int PyModule_AddStringConstant(object module, char *name, char *value) except -1
int PyModule_AddStringConstant(object module, const char *name, const char *value) except -1
# Add a string constant to module as name. This convenience
# function can be used from the module's initialization
# function. The string value must be null-terminated. Return -1 on
......
......@@ -82,12 +82,12 @@ cdef extern from "Python.h":
# option currently supported is Py_PRINT_RAW; if given, the str()
# of the object is written instead of the repr().
bint PyObject_HasAttrString(object o, char *attr_name)
bint PyObject_HasAttrString(object o, const char *attr_name)
# Returns 1 if o has the attribute attr_name, and 0
# otherwise. This is equivalent to the Python expression
# "hasattr(o, attr_name)". This function always succeeds.
object PyObject_GetAttrString(object o, char *attr_name)
object PyObject_GetAttrString(object o, const char *attr_name)
# Return value: New reference. Retrieve an attribute named
# attr_name from object o. Returns the attribute value on success,
# or NULL on failure. This is the equivalent of the Python
......@@ -106,7 +106,7 @@ cdef extern from "Python.h":
object PyObject_GenericGetAttr(object o, object attr_name)
int PyObject_SetAttrString(object o, char *attr_name, object v) except -1
int PyObject_SetAttrString(object o, const char *attr_name, object v) except -1
# Set the value of the attribute named attr_name, for object o, to
# the value v. Returns -1 on failure. This is the equivalent of
# the Python statement "o.attr_name = v".
......@@ -118,7 +118,7 @@ cdef extern from "Python.h":
int PyObject_GenericSetAttr(object o, object attr_name, object v) except -1
int PyObject_DelAttrString(object o, char *attr_name) except -1
int PyObject_DelAttrString(object o, const char *attr_name) except -1
# Delete attribute named attr_name, for object o. Returns -1 on
# failure. This is the equivalent of the Python statement: "del
# o.attr_name".
......
......@@ -1138,9 +1138,9 @@ static CYTHON_INLINE int __Pyx_Is_Little_Endian(void)
static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) {
PyObject *m = NULL, *p = NULL;
void *r = NULL;
m = PyImport_ImportModule((char *)modname);
m = PyImport_ImportModule(modname);
if (!m) goto end;
p = PyObject_GetAttrString(m, (char *)"RefNannyAPI");
p = PyObject_GetAttrString(m, "RefNannyAPI");
if (!p) goto end;
r = PyLong_AsVoidPtr(p);
end:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment