diff options
author | Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> | 2020-02-11 18:47:20 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-02-11 18:47:20 -0800 |
commit | 190433d8150bf719fa0ba972dbacf2214942f54e (patch) | |
tree | 542d09915c36b8e496c0c66950eb0bf29704e271 /Python/marshal.c | |
parent | 0f0d2e496205c345b182b6572ee09db23f8f9daf (diff) | |
download | cpython-190433d8150bf719fa0ba972dbacf2214942f54e.tar.gz cpython-190433d8150bf719fa0ba972dbacf2214942f54e.zip |
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
(cherry picked from commit e6be9b59a911626d6597fe148c32f0342bd2bd24)
Co-authored-by: Andy Lester <andy@petdance.com>
Diffstat (limited to 'Python/marshal.c')
-rw-r--r-- | Python/marshal.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/Python/marshal.c b/Python/marshal.c index c6a06e8c239..d3fee32380b 100644 --- a/Python/marshal.c +++ b/Python/marshal.c @@ -734,7 +734,7 @@ r_byte(RFILE *p) else { const char *ptr = r_string(1, p); if (ptr != NULL) - c = *(unsigned char *) ptr; + c = *(const unsigned char *) ptr; } return c; } |