diff --git a/Include/internal/pycore_code.h b/Include/internal/pycore_code.h index 32242f89b812e6..293c1ea4414e23 100644 --- a/Include/internal/pycore_code.h +++ b/Include/internal/pycore_code.h @@ -205,7 +205,7 @@ _PyLocals_GetKind(PyObject *kinds, int i) { assert(PyBytes_Check(kinds)); assert(0 <= i && i < PyBytes_GET_SIZE(kinds)); - char *ptr = PyBytes_AS_STRING(kinds); + const char *ptr = PyBytes_AS_STRING(kinds); return (_PyLocals_Kind)(ptr[i]); } diff --git a/Modules/_sqlite/blob.c b/Modules/_sqlite/blob.c index d81784409e5d91..cae1806d4ba284 100644 --- a/Modules/_sqlite/blob.c +++ b/Modules/_sqlite/blob.c @@ -457,7 +457,7 @@ subscript_slice(pysqlite_Blob *self, PyObject *item) } char *res_buf = PyBytesWriter_GetData(writer); - char *blob_buf = PyBytes_AS_STRING(blob); + const char *blob_buf = PyBytes_AS_STRING(blob); for (Py_ssize_t i = 0, j = 0; i < len; i++, j += step) { res_buf[i] = blob_buf[j]; } diff --git a/Modules/socketmodule.c b/Modules/socketmodule.c index f9c77c631b5d2a..66525df2ec4bba 100644 --- a/Modules/socketmodule.c +++ b/Modules/socketmodule.c @@ -1803,7 +1803,7 @@ makesockaddr(SOCKET_T sockfd, struct sockaddr *addr, size_t addrlen, int proto) (in particular, numeric IP addresses). */ struct maybe_idna { PyObject *obj; - char *buf; + const char *buf; }; static void diff --git a/Objects/stringlib/codecs.h b/Objects/stringlib/codecs.h index 9e53fab842909a..6ea7ef1c9a92bf 100644 --- a/Objects/stringlib/codecs.h +++ b/Objects/stringlib/codecs.h @@ -406,7 +406,7 @@ STRINGLIB(utf8_encoder)(PyObject *unicode, writer->overallocate = (newpos < size); } - char *rep_str; + const char *rep_str; Py_ssize_t rep_len; if (PyBytes_Check(rep)) { rep_str = PyBytes_AS_STRING(rep); diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c index 45d61c8b8b765a..2249280d0af811 100644 --- a/Objects/unicodeobject.c +++ b/Objects/unicodeobject.c @@ -7314,7 +7314,7 @@ unicode_encode_ucs1(PyObject *unicode, writer->overallocate = (newpos < size); } - char *rep_str; + const char *rep_str; Py_ssize_t rep_len; if (PyBytes_Check(rep)) { /* Directly copy bytes result to output. */ diff --git a/Parser/action_helpers.c b/Parser/action_helpers.c index 809f3c0a7b270e..8690dca8331b5c 100644 --- a/Parser/action_helpers.c +++ b/Parser/action_helpers.c @@ -1481,7 +1481,7 @@ expr_ty _PyPegen_decoded_constant_from_token(Parser* p, Token* tok) { } expr_ty _PyPegen_constant_from_token(Parser* p, Token* tok) { - char* bstr = PyBytes_AsString(tok->bytes); + const char* bstr = PyBytes_AsString(tok->bytes); if (bstr == NULL) { return NULL; } @@ -1499,7 +1499,7 @@ expr_ty _PyPegen_constant_from_token(Parser* p, Token* tok) { } expr_ty _PyPegen_constant_from_string(Parser* p, Token* tok) { - char* the_str = PyBytes_AsString(tok->bytes); + const char* the_str = PyBytes_AsString(tok->bytes); if (the_str == NULL) { return NULL; } diff --git a/Parser/string_parser.c b/Parser/string_parser.c index b164dfbc81a933..431d2703d88e2c 100644 --- a/Parser/string_parser.c +++ b/Parser/string_parser.c @@ -70,7 +70,7 @@ warn_invalid_escape_sequence(Parser *p, const char* buffer, const char *first_in char first_quote = 0; if (lineno == t->lineno) { int quote_count = 0; - char* tok = PyBytes_AsString(t->bytes); + const char* tok = PyBytes_AsString(t->bytes); for (int i = 0; i < PyBytes_Size(t->bytes); i++) { if (tok[i] == '\'' || tok[i] == '\"') { if (quote_count == 0) {