Commit 03426fc2 authored by Kevin Modzelewski's avatar Kevin Modzelewski

Fix a few const correctness issues

I'm not sure why clang doesn't warn about these, since it's supposed to support
the -Wconst-qual warning that these violate.
parent b4a0af80
......@@ -326,7 +326,7 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/
*/
PyAPI_FUNC(PyObject *) PyObject_CallFunction(PyObject *callable_object,
char *format, ...) PYSTON_NOEXCEPT;
const char *format, ...) PYSTON_NOEXCEPT;
/*
Call a callable Python object, callable_object, with a
......@@ -339,8 +339,8 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/
*/
PyAPI_FUNC(PyObject *) PyObject_CallMethod(PyObject *o, char *m,
char *format, ...) PYSTON_NOEXCEPT;
PyAPI_FUNC(PyObject *) PyObject_CallMethod(PyObject *o, const char *m,
const char *format, ...) PYSTON_NOEXCEPT;
/*
Call the method named m of object o with a variable number of
......@@ -352,10 +352,10 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/
*/
PyAPI_FUNC(PyObject *) _PyObject_CallFunction_SizeT(PyObject *callable,
char *format, ...) PYSTON_NOEXCEPT;
const char *format, ...) PYSTON_NOEXCEPT;
PyAPI_FUNC(PyObject *) _PyObject_CallMethod_SizeT(PyObject *o,
char *name,
char *format, ...) PYSTON_NOEXCEPT;
const char *name,
const char *format, ...) PYSTON_NOEXCEPT;
PyAPI_FUNC(PyObject *) PyObject_CallFunctionObjArgs(PyObject *callable,
...) PYSTON_NOEXCEPT;
......
......@@ -9,14 +9,14 @@ extern "C" {
#endif
PyAPI_FUNC(long) PyImport_GetMagicNumber(void) PYSTON_NOEXCEPT;
PyAPI_FUNC(PyObject *) PyImport_ExecCodeModule(char *name, PyObject *co) PYSTON_NOEXCEPT;
PyAPI_FUNC(PyObject *) PyImport_ExecCodeModule(const char *name, PyObject *co) PYSTON_NOEXCEPT;
PyAPI_FUNC(PyObject *) PyImport_ExecCodeModuleEx(
char *name, PyObject *co, char *pathname) PYSTON_NOEXCEPT;
PyAPI_FUNC(PyObject *) PyImport_GetModuleDict(void) PYSTON_NOEXCEPT;
PyAPI_FUNC(PyObject *) PyImport_AddModule(const char *name) PYSTON_NOEXCEPT;
PyAPI_FUNC(PyObject *) PyImport_ImportModule(const char *name) PYSTON_NOEXCEPT;
PyAPI_FUNC(PyObject *) PyImport_ImportModuleNoBlock(const char *) PYSTON_NOEXCEPT;
PyAPI_FUNC(PyObject *) PyImport_ImportModuleLevel(char *name,
PyAPI_FUNC(PyObject *) PyImport_ImportModuleLevel(const char *name,
PyObject *globals, PyObject *locals, PyObject *fromlist, int level) PYSTON_NOEXCEPT;
#define PyImport_ImportModuleEx(n, g, l, f) \
......
......@@ -328,11 +328,11 @@ static PyObject* call_function_tail(PyObject* callable, PyObject* args) {
return retval;
}
extern "C" PyObject* PyObject_CallMethod(PyObject* o, char* name, char* format, ...) noexcept {
extern "C" PyObject* PyObject_CallMethod(PyObject* o, const char* name, const char* format, ...) noexcept {
Py_FatalError("unimplemented");
}
extern "C" PyObject* _PyObject_CallMethod_SizeT(PyObject* o, char* name, char* format, ...) noexcept {
extern "C" PyObject* _PyObject_CallMethod_SizeT(PyObject* o, const char* name, const char* format, ...) noexcept {
// TODO it looks like this could be made much more efficient by calling our callattr(), but
// I haven't taken the time to verify that that has the same behavior
......@@ -468,7 +468,7 @@ extern "C" int PyObject_IsSubclass(PyObject* derived, PyObject* cls) noexcept {
return recursive_issubclass(derived, cls);
}
extern "C" PyObject* _PyObject_CallFunction_SizeT(PyObject* callable, char* format, ...) noexcept {
extern "C" PyObject* _PyObject_CallFunction_SizeT(PyObject* callable, const char* format, ...) noexcept {
Py_FatalError("unimplemented");
}
......@@ -619,7 +619,7 @@ extern "C" PyObject* PySequence_List(PyObject* v) noexcept {
return result;
}
extern "C" PyObject* PyObject_CallFunction(PyObject* callable, char* format, ...) noexcept {
extern "C" PyObject* PyObject_CallFunction(PyObject* callable, const char* format, ...) noexcept {
Py_FatalError("unimplemented");
}
......
......@@ -244,7 +244,7 @@ static PyObject* codec_getincrementalcodec(const char* encoding, const char* err
if (inccodec == NULL)
return NULL;
if (errors)
ret = PyObject_CallFunction(inccodec, (char*)"s", errors);
ret = PyObject_CallFunction(inccodec, "s", errors);
else
ret = PyObject_CallFunction(inccodec, NULL);
Py_DECREF(inccodec);
......@@ -262,9 +262,9 @@ static PyObject* codec_getstreamcodec(const char* encoding, PyObject* stream, co
codeccls = PyTuple_GET_ITEM(codecs, index);
if (errors != NULL)
streamcodec = PyObject_CallFunction(codeccls, (char*)"Os", stream, errors);
streamcodec = PyObject_CallFunction(codeccls, "Os", stream, errors);
else
streamcodec = PyObject_CallFunction(codeccls, (char*)"O", stream);
streamcodec = PyObject_CallFunction(codeccls, "O", stream);
Py_DECREF(codecs);
return streamcodec;
}
......@@ -396,7 +396,7 @@ int PyCodec_RegisterError(const char* name, PyObject* error) noexcept {
PyErr_SetString(PyExc_TypeError, "handler must be callable");
return -1;
}
return PyDict_SetItemString(interp->codec_error_registry, (char*)name, error);
return PyDict_SetItemString(interp->codec_error_registry, name, error);
}
/* Lookup the error handling callback function registered under the
......@@ -412,7 +412,7 @@ PyObject* PyCodec_LookupError(const char* name) noexcept {
if (name == NULL)
name = "strict";
handler = PyDict_GetItemString(interp->codec_error_registry, (char*)name);
handler = PyDict_GetItemString(interp->codec_error_registry, name);
if (!handler)
PyErr_Format(PyExc_LookupError, "unknown error handler name '%.400s'", name);
else
......@@ -769,7 +769,7 @@ static int _PyCodecRegistry_Init(void) {
if (interp->codec_search_path == NULL || interp->codec_search_cache == NULL || interp->codec_error_registry == NULL)
Py_FatalError("can't initialize codec registry");
mod = PyImport_ImportModuleLevel((char*)"encodings", NULL, NULL, NULL, 0);
mod = PyImport_ImportModuleLevel("encodings", NULL, NULL, NULL, 0);
if (mod == NULL) {
if (PyErr_ExceptionMatches(PyExc_ImportError)) {
/* Ignore ImportErrors... this is done so that
......
......@@ -213,8 +213,8 @@ extern "C" PyObject* PyImport_ImportModuleNoBlock(const char* name) noexcept {
}
// This function has the same behaviour as __import__()
extern "C" PyObject* PyImport_ImportModuleLevel(char* name, PyObject* globals, PyObject* locals, PyObject* fromlist,
int level) noexcept {
extern "C" PyObject* PyImport_ImportModuleLevel(const char* name, PyObject* globals, PyObject* locals,
PyObject* fromlist, int level) noexcept {
RELEASE_ASSERT(globals == NULL, "not implemented");
RELEASE_ASSERT(locals == NULL, "not implemented");
RELEASE_ASSERT(fromlist == NULL, "not implemented");
......
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