Staging
v0.5.1
https://github.com/python/cpython
Revision 190433d8150bf719fa0ba972dbacf2214942f54e authored by Miss Islington (bot) on 12 February 2020, 02:47:20 UTC, committed by GitHub on 12 February 2020, 02:47:20 UTC

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
(cherry picked from commit e6be9b59a911626d6597fe148c32f0342bd2bd24)

Co-authored-by: Andy Lester <andy@petdance.com>
1 parent 0f0d2e4
History
Tip revision: 190433d8150bf719fa0ba972dbacf2214942f54e authored by Miss Islington (bot) on 12 February 2020, 02:47:20 UTC
closes bpo-39605: Fix some casts to not cast away const. (GH-18453)
Tip revision: 190433d
File Mode Size
.azure-pipelines
.github
Doc
Grammar
Include
Lib
Mac
Misc
Modules
Objects
PC
PCbuild
Parser
Programs
Python
Tools
m4
.gitattributes -rw-r--r-- 1.8 KB
.gitignore -rw-r--r-- 1.7 KB
.travis.yml -rw-r--r-- 8.1 KB
CODE_OF_CONDUCT.md -rw-r--r-- 630 bytes
LICENSE -rw-r--r-- 12.5 KB
Makefile.pre.in -rw-r--r-- 66.0 KB
README.rst -rw-r--r-- 9.8 KB
aclocal.m4 -rw-r--r-- 10.7 KB
config.guess -rwxr-xr-x 43.1 KB
config.sub -rwxr-xr-x 35.4 KB
configure -rwxr-xr-x 491.4 KB
configure.ac -rw-r--r-- 162.5 KB
install-sh -rwxr-xr-x 15.0 KB
pyconfig.h.in -rw-r--r-- 44.2 KB
setup.py -rw-r--r-- 101.7 KB

README.rst

back to top