[Python-checkins] closes bpo-39630: Update pointers to string literals to be const char *. (GH-18510)
Andy Lester
webhook-mailer at python.org
Thu Feb 13 23:43:16 EST 2020
https://github.com/python/cpython/commit/7386a70746cf9aaf2d95db75d9201fb124f085df
commit: 7386a70746cf9aaf2d95db75d9201fb124f085df
branch: master
author: Andy Lester <andy at petdance.com>
committer: GitHub <noreply at github.com>
date: 2020-02-13T20:42:56-08:00
summary:
closes bpo-39630: Update pointers to string literals to be const char *. (GH-18510)
files:
M Objects/frameobject.c
M Objects/genobject.c
M Python/codecs.c
M Python/errors.c
diff --git a/Objects/frameobject.c b/Objects/frameobject.c
index 4469e3c20cd2f..64f5754fe2013 100644
--- a/Objects/frameobject.c
+++ b/Objects/frameobject.c
@@ -475,7 +475,7 @@ frame_setlineno(PyFrameObject *f, PyObject* p_new_lineno, void *Py_UNUSED(ignore
if (new_stack.depth > current_stack.depth ||
top_block(&new_stack)->start_line != current_block_at_new_depth->start_line) {
unsigned char target_kind = top_block(&new_stack)->kind;
- char *msg;
+ const char *msg;
if (target_kind == POP_EXCEPT) {
msg = "can't jump into an 'except' block as there's no exception";
}
diff --git a/Objects/genobject.c b/Objects/genobject.c
index 0837698fd784c..ef892bb0366b8 100644
--- a/Objects/genobject.c
+++ b/Objects/genobject.c
@@ -12,10 +12,10 @@ static PyObject *gen_close(PyGenObject *, PyObject *);
static PyObject *async_gen_asend_new(PyAsyncGenObject *, PyObject *);
static PyObject *async_gen_athrow_new(PyAsyncGenObject *, PyObject *);
-static char *NON_INIT_CORO_MSG = "can't send non-None value to a "
+static const char *NON_INIT_CORO_MSG = "can't send non-None value to a "
"just-started coroutine";
-static char *ASYNC_GEN_IGNORED_EXIT_MSG =
+static const char *ASYNC_GEN_IGNORED_EXIT_MSG =
"async generator ignored GeneratorExit";
static inline int
diff --git a/Python/codecs.c b/Python/codecs.c
index ce86cb20ccccc..e5bcdb09fc596 100644
--- a/Python/codecs.c
+++ b/Python/codecs.c
@@ -1407,7 +1407,7 @@ static PyObject *surrogateescape_errors(PyObject *self, PyObject *exc)
static int _PyCodecRegistry_Init(void)
{
static struct {
- char *name;
+ const char *name;
PyMethodDef def;
} methods[] =
{
diff --git a/Python/errors.c b/Python/errors.c
index f11b66e7958ea..61dc597916d72 100644
--- a/Python/errors.c
+++ b/Python/errors.c
@@ -614,7 +614,7 @@ PyErr_SetFromErrnoWithFilenameObjects(PyObject *exc, PyObject *filenameObject, P
#ifndef MS_WINDOWS
if (i != 0) {
- char *s = strerror(i);
+ const char *s = strerror(i);
message = PyUnicode_DecodeLocale(s, "surrogateescape");
}
else {
More information about the Python-checkins
mailing list