Add the const qualifier to "char *" variables that refer to literal strings. (#4370)

diff --git a/Objects/bytearrayobject.c b/Objects/bytearrayobject.c
index 83c3549..dc1515a 100644
--- a/Objects/bytearrayobject.c
+++ b/Objects/bytearrayobject.c
@@ -1806,7 +1806,8 @@
 /*[clinic end generated code: output=760412661a34ad5a input=ef7bb59b09c21d62]*/
 {
     Py_ssize_t left, right, mysize, byteslen;
-    char *myptr, *bytesptr;
+    char *myptr;
+    const char *bytesptr;
     Py_buffer vbytes;
 
     if (bytes == Py_None) {
@@ -1816,7 +1817,7 @@
     else {
         if (PyObject_GetBuffer(bytes, &vbytes, PyBUF_SIMPLE) != 0)
             return NULL;
-        bytesptr = (char *) vbytes.buf;
+        bytesptr = (const char *) vbytes.buf;
         byteslen = vbytes.len;
     }
     myptr = PyByteArray_AS_STRING(self);
@@ -1847,7 +1848,8 @@
 /*[clinic end generated code: output=d005c9d0ab909e66 input=80843f975dd7c480]*/
 {
     Py_ssize_t left, right, mysize, byteslen;
-    char *myptr, *bytesptr;
+    char *myptr;
+    const char *bytesptr;
     Py_buffer vbytes;
 
     if (bytes == Py_None) {
@@ -1857,7 +1859,7 @@
     else {
         if (PyObject_GetBuffer(bytes, &vbytes, PyBUF_SIMPLE) != 0)
             return NULL;
-        bytesptr = (char *) vbytes.buf;
+        bytesptr = (const char *) vbytes.buf;
         byteslen = vbytes.len;
     }
     myptr = PyByteArray_AS_STRING(self);
@@ -1885,7 +1887,8 @@
 /*[clinic end generated code: output=030e2fbd2f7276bd input=e728b994954cfd91]*/
 {
     Py_ssize_t right, mysize, byteslen;
-    char *myptr, *bytesptr;
+    char *myptr;
+    const char *bytesptr;
     Py_buffer vbytes;
 
     if (bytes == Py_None) {
@@ -1895,7 +1898,7 @@
     else {
         if (PyObject_GetBuffer(bytes, &vbytes, PyBUF_SIMPLE) != 0)
             return NULL;
-        bytesptr = (char *) vbytes.buf;
+        bytesptr = (const char *) vbytes.buf;
         byteslen = vbytes.len;
     }
     myptr = PyByteArray_AS_STRING(self);
diff --git a/Objects/classobject.c b/Objects/classobject.c
index 063c24a..e88c95c 100644
--- a/Objects/classobject.c
+++ b/Objects/classobject.c
@@ -543,7 +543,7 @@
 {
     PyObject *func = PyInstanceMethod_Function(self);
     PyObject *funcname = NULL , *result = NULL;
-    char *defname = "?";
+    const char *defname = "?";
 
     if (func == NULL) {
         PyErr_BadInternalCall();
diff --git a/Objects/complexobject.c b/Objects/complexobject.c
index 3bf37ee..4bcf2ce 100644
--- a/Objects/complexobject.c
+++ b/Objects/complexobject.c
@@ -363,9 +363,9 @@
     /* These do not need to be freed. re is either an alias
        for pre or a pointer to a constant.  lead and tail
        are pointers to constants. */
-    char *re = NULL;
-    char *lead = "";
-    char *tail = "";
+    const char *re = NULL;
+    const char *lead = "";
+    const char *tail = "";
 
     if (v->cval.real == 0. && copysign(1.0, v->cval.real)==1.0) {
         /* Real part is +0: just output the imaginary part and do not
diff --git a/Objects/genobject.c b/Objects/genobject.c
index 7793a54..00a8823 100644
--- a/Objects/genobject.c
+++ b/Objects/genobject.c
@@ -152,7 +152,7 @@
     PyObject *result;
 
     if (gen->gi_running) {
-        char *msg = "generator already executing";
+        const char *msg = "generator already executing";
         if (PyCoro_CheckExact(gen)) {
             msg = "coroutine already executing";
         }
@@ -186,8 +186,8 @@
 
     if (f->f_lasti == -1) {
         if (arg && arg != Py_None) {
-            char *msg = "can't send non-None value to a "
-                        "just-started generator";
+            const char *msg = "can't send non-None value to a "
+                              "just-started generator";
             if (PyCoro_CheckExact(gen)) {
                 msg = NON_INIT_CORO_MSG;
             }
@@ -410,7 +410,7 @@
         PyErr_SetNone(PyExc_GeneratorExit);
     retval = gen_send_ex(gen, Py_None, 1, 1);
     if (retval) {
-        char *msg = "generator ignored GeneratorExit";
+        const char *msg = "generator ignored GeneratorExit";
         if (PyCoro_CheckExact(gen)) {
             msg = "coroutine ignored GeneratorExit";
         } else if (PyAsyncGen_CheckExact(gen)) {
diff --git a/Objects/obmalloc.c b/Objects/obmalloc.c
index 7f5306f..4441c82 100644
--- a/Objects/obmalloc.c
+++ b/Objects/obmalloc.c
@@ -1646,7 +1646,7 @@
 {
     const uint8_t *q = (const uint8_t *)p;
     char msgbuf[64];
-    char *msg;
+    const char *msg;
     size_t nbytes;
     const uint8_t *tail;
     int i;
@@ -1661,7 +1661,7 @@
     id = (char)q[-SST];
     if (id != api) {
         msg = msgbuf;
-        snprintf(msg, sizeof(msgbuf), "bad ID: Allocated using API '%c', verified using API '%c'", id, api);
+        snprintf(msgbuf, sizeof(msgbuf), "bad ID: Allocated using API '%c', verified using API '%c'", id, api);
         msgbuf[sizeof(msgbuf)-1] = 0;
         goto error;
     }
diff --git a/Objects/odictobject.c b/Objects/odictobject.c
index afacb36..5d22ce7 100644
--- a/Objects/odictobject.c
+++ b/Objects/odictobject.c
@@ -1625,7 +1625,7 @@
     if (len == -1)
         return -1;
     if (len > 1) {
-        char *msg = "expected at most 1 arguments, got %d";
+        const char *msg = "expected at most 1 arguments, got %d";
         PyErr_Format(PyExc_TypeError, msg, len);
         return -1;
     }
@@ -2337,7 +2337,7 @@
     assert(args == NULL || PyTuple_Check(args));
     len = (args != NULL) ? PyTuple_GET_SIZE(args) : 0;
     if (len > 1) {
-        char *msg = "update() takes at most 1 positional argument (%d given)";
+        const char *msg = "update() takes at most 1 positional argument (%d given)";
         PyErr_Format(PyExc_TypeError, msg, len);
         return NULL;
     }
diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c
index 194c5bc..fdc3197 100644
--- a/Objects/unicodeobject.c
+++ b/Objects/unicodeobject.c
@@ -8396,8 +8396,8 @@
     Py_ssize_t collstartpos = *inpos;
     Py_ssize_t collendpos = *inpos+1;
     Py_ssize_t collpos;
-    char *encoding = "charmap";
-    char *reason = "character maps to <undefined>";
+    const char *encoding = "charmap";
+    const char *reason = "character maps to <undefined>";
     charmapencode_result x;
     Py_UCS4 ch;
     int val;
@@ -8928,7 +8928,7 @@
     /* output buffer */
     _PyUnicodeWriter writer;
     /* error handler */
-    char *reason = "character maps to <undefined>";
+    const char *reason = "character maps to <undefined>";
     PyObject *errorHandler = NULL;
     PyObject *exc = NULL;
     int ignore;