summaryrefslogtreecommitdiff
path: root/Python
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2017-11-11 13:06:26 +0200
committerGitHub <noreply@github.com>2017-11-11 13:06:26 +0200
commite2f92de6a90ae11a6d8e01bd17fd88b005516835 (patch)
treea5bc255a98f488e5ecf195dc3f55665e9afecc47 /Python
parente184cfd7bf8bcfd160e3b611d4351ca3ce52d9e2 (diff)
downloadcpython-git-e2f92de6a90ae11a6d8e01bd17fd88b005516835.tar.gz
Add the const qualifier to "char *" variables that refer to literal strings. (#4370)
Diffstat (limited to 'Python')
-rw-r--r--Python/bltinmodule.c2
-rw-r--r--Python/compile.c2
-rw-r--r--Python/pyhash.c2
-rw-r--r--Python/pystrtod.c3
-rw-r--r--Python/pythonrun.c2
5 files changed, 6 insertions, 5 deletions
diff --git a/Python/bltinmodule.c b/Python/bltinmodule.c
index 6215a638c9..8eac0af352 100644
--- a/Python/bltinmodule.c
+++ b/Python/bltinmodule.c
@@ -1942,7 +1942,7 @@ builtin_input_impl(PyObject *module, PyObject *prompt)
/* If we're interactive, use (GNU) readline */
if (tty) {
PyObject *po = NULL;
- char *promptstr;
+ const char *promptstr;
char *s = NULL;
PyObject *stdin_encoding = NULL, *stdin_errors = NULL;
PyObject *stdout_encoding = NULL, *stdout_errors = NULL;
diff --git a/Python/compile.c b/Python/compile.c
index 58a708ce23..a3ea60d07c 100644
--- a/Python/compile.c
+++ b/Python/compile.c
@@ -4846,7 +4846,7 @@ compiler_visit_nested_slice(struct compiler *c, slice_ty s,
static int
compiler_visit_slice(struct compiler *c, slice_ty s, expr_context_ty ctx)
{
- char * kindname = NULL;
+ const char * kindname = NULL;
switch (s->kind) {
case Index_kind:
kindname = "index";
diff --git a/Python/pyhash.c b/Python/pyhash.c
index 8a6bd60c10..aa49eeb35b 100644
--- a/Python/pyhash.c
+++ b/Python/pyhash.c
@@ -196,7 +196,7 @@ _PyHash_Fini(void)
#ifdef Py_HASH_STATS
int i;
Py_ssize_t total = 0;
- char *fmt = "%2i %8" PY_FORMAT_SIZE_T "d %8" PY_FORMAT_SIZE_T "d\n";
+ const char *fmt = "%2i %8" PY_FORMAT_SIZE_T "d %8" PY_FORMAT_SIZE_T "d\n";
fprintf(stderr, "len calls total\n");
for (i = 1; i <= Py_HASH_STATS_MAX; i++) {
diff --git a/Python/pystrtod.c b/Python/pystrtod.c
index f19d2399b3..9bf9363862 100644
--- a/Python/pystrtod.c
+++ b/Python/pystrtod.c
@@ -597,7 +597,8 @@ Py_LOCAL_INLINE(char *)
ensure_decimal_point(char* buffer, size_t buf_size, int precision)
{
int digit_count, insert_count = 0, convert_to_exp = 0;
- char *chars_to_insert, *digits_start;
+ const char *chars_to_insert;
+ char *digits_start;
/* search for the first non-digit character */
char *p = buffer;
diff --git a/Python/pythonrun.c b/Python/pythonrun.c
index 17ec182b74..3d63186a36 100644
--- a/Python/pythonrun.c
+++ b/Python/pythonrun.c
@@ -1300,7 +1300,7 @@ err_input(perrdetail *err)
{
PyObject *v, *w, *errtype, *errtext;
PyObject *msg_obj = NULL;
- char *msg = NULL;
+ const char *msg = NULL;
int offset = err->offset;
errtype = PyExc_SyntaxError;