summaryrefslogtreecommitdiffstats
path: root/Python/ceval.c
diff options
context:
space:
mode:
authorAndy Lester <andy@petdance.com>2020-02-12 02:28:35 (GMT)
committerGitHub <noreply@github.com>2020-02-12 02:28:35 (GMT)
commite6be9b59a911626d6597fe148c32f0342bd2bd24 (patch)
treef5912158983ae1a5adcdc2131c183d09012588f8 /Python/ceval.c
parent029e8401b7741cc0964b5f38d2c2264749dbff6b (diff)
downloadcpython-e6be9b59a911626d6597fe148c32f0342bd2bd24.zip
cpython-e6be9b59a911626d6597fe148c32f0342bd2bd24.tar.gz
cpython-e6be9b59a911626d6597fe148c32f0342bd2bd24.tar.bz2
closes bpo-39605: Fix some casts to not cast away const. (GH-18453)
gcc -Wcast-qual turns up a number of instances of casting away constness of pointers. Some of these can be safely modified, by either: Adding the const to the type cast, as in: - return _PyUnicode_FromUCS1((unsigned char*)s, size); + return _PyUnicode_FromUCS1((const unsigned char*)s, size); or, Removing the cast entirely, because it's not necessary (but probably was at one time), as in: - PyDTrace_FUNCTION_ENTRY((char *)filename, (char *)funcname, lineno); + PyDTrace_FUNCTION_ENTRY(filename, funcname, lineno); These changes will not change code, but they will make it much easier to check for errors in consts
Diffstat (limited to 'Python/ceval.c')
-rw-r--r--Python/ceval.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/Python/ceval.c b/Python/ceval.c
index eb0f131..426d0bb 100644
--- a/Python/ceval.c
+++ b/Python/ceval.c
@@ -5440,7 +5440,7 @@ dtrace_function_entry(PyFrameObject *f)
funcname = PyUnicode_AsUTF8(f->f_code->co_name);
lineno = PyCode_Addr2Line(f->f_code, f->f_lasti);
- PyDTrace_FUNCTION_ENTRY((char *)filename, (char *)funcname, lineno);
+ PyDTrace_FUNCTION_ENTRY(filename, funcname, lineno);
}
static void
@@ -5454,7 +5454,7 @@ dtrace_function_return(PyFrameObject *f)
funcname = PyUnicode_AsUTF8(f->f_code->co_name);
lineno = PyCode_Addr2Line(f->f_code, f->f_lasti);
- PyDTrace_FUNCTION_RETURN((char *)filename, (char *)funcname, lineno);
+ PyDTrace_FUNCTION_RETURN(filename, funcname, lineno);
}
/* DTrace equivalent of maybe_call_line_trace. */
@@ -5486,7 +5486,7 @@ maybe_dtrace_line(PyFrameObject *frame,
co_name = PyUnicode_AsUTF8(frame->f_code->co_name);
if (!co_name)
co_name = "?";
- PyDTrace_LINE((char *)co_filename, (char *)co_name, line);
+ PyDTrace_LINE(co_filename, co_name, line);
}
*instr_prev = frame->f_lasti;
}