Removed redundant casts to `char *`.
Corresponding functions now accept `const char *` (issue #1772673).
diff --git a/Modules/_cursesmodule.c b/Modules/_cursesmodule.c
index 5ffce2f..6b77868 100644
--- a/Modules/_cursesmodule.c
+++ b/Modules/_cursesmodule.c
@@ -2675,7 +2675,7 @@
}
knp = keyname(ch);
- return PyBytes_FromString((knp == NULL) ? "" : (char *)knp);
+ return PyBytes_FromString((knp == NULL) ? "" : knp);
}
#endif
diff --git a/Modules/_decimal/_decimal.c b/Modules/_decimal/_decimal.c
index f000887..169914c 100644
--- a/Modules/_decimal/_decimal.c
+++ b/Modules/_decimal/_decimal.c
@@ -5640,7 +5640,7 @@
goto error; /* GCOV_NOT_REACHED */
}
- ASSIGN_PTR(cm->ex, PyErr_NewException((char *)cm->fqname, base, NULL));
+ ASSIGN_PTR(cm->ex, PyErr_NewException(cm->fqname, base, NULL));
Py_DECREF(base);
/* add to module */
@@ -5672,7 +5672,7 @@
goto error; /* GCOV_NOT_REACHED */
}
- ASSIGN_PTR(cm->ex, PyErr_NewException((char *)cm->fqname, base, NULL));
+ ASSIGN_PTR(cm->ex, PyErr_NewException(cm->fqname, base, NULL));
Py_DECREF(base);
Py_INCREF(cm->ex);
diff --git a/Modules/cjkcodecs/cjkcodecs.h b/Modules/cjkcodecs/cjkcodecs.h
index 25bab41..4cd2088 100644
--- a/Modules/cjkcodecs/cjkcodecs.h
+++ b/Modules/cjkcodecs/cjkcodecs.h
@@ -362,7 +362,7 @@
if (mod == NULL)
return -1;
- o = PyObject_GetAttrString(mod, (char*)symbol);
+ o = PyObject_GetAttrString(mod, symbol);
if (o == NULL)
goto errorexit;
else if (!PyCapsule_IsValid(o, PyMultibyteCodec_CAPSULE_NAME)) {
diff --git a/Modules/cjkcodecs/multibytecodec.c b/Modules/cjkcodecs/multibytecodec.c
index 74ecafd..31bb35f 100644
--- a/Modules/cjkcodecs/multibytecodec.c
+++ b/Modules/cjkcodecs/multibytecodec.c
@@ -1269,10 +1269,10 @@
if (sizehint < 0)
cres = PyObject_CallMethod(self->stream,
- (char *)method, NULL);
+ method, NULL);
else
cres = PyObject_CallMethod(self->stream,
- (char *)method, "i", sizehint);
+ method, "i", sizehint);
if (cres == NULL)
goto errorexit;
diff --git a/Modules/pyexpat.c b/Modules/pyexpat.c
index 9c21bed..88984e7 100644
--- a/Modules/pyexpat.c
+++ b/Modules/pyexpat.c
@@ -1478,7 +1478,7 @@
static PyObject *
-newxmlparseobject(char *encoding, char *namespace_separator, PyObject *intern)
+newxmlparseobject(const char *encoding, const char *namespace_separator, PyObject *intern)
{
int i;
xmlparseobject *self;
@@ -1932,8 +1932,7 @@
return NULL;
}
- result = newxmlparseobject((char *)encoding, (char *)namespace_separator,
- intern);
+ result = newxmlparseobject(encoding, namespace_separator, intern);
if (intern_decref) {
Py_DECREF(intern);
}
@@ -2074,7 +2073,7 @@
PyModule_AddObject(m, "XMLParserType", (PyObject *) &Xmlparsetype);
PyModule_AddStringConstant(m, "EXPAT_VERSION",
- (char *) XML_ExpatVersion());
+ XML_ExpatVersion());
{
XML_Expat_Version info = XML_ExpatVersionInfo();
PyModule_AddObject(m, "version_info",
@@ -2154,7 +2153,7 @@
#define MYCONST(name) \
if (PyModule_AddStringConstant(errors_module, #name, \
- (char *)XML_ErrorString(name)) < 0) \
+ XML_ErrorString(name)) < 0) \
return NULL; \
tmpnum = PyLong_FromLong(name); \
if (tmpnum == NULL) return NULL; \