This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Fix some casts to not cast away const
Type: enhancement Stage: resolved
Components: Interpreter Core Versions:
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: benjamin.peterson, miss-islington, petdance
Priority: normal Keywords: patch

Created on 2020-02-11 04:45 by petdance, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 18453 merged petdance, 2020-02-11 04:48
PR 18471 merged miss-islington, 2020-02-12 02:28
PR 18473 merged benjamin.peterson, 2020-02-12 03:07
PR 18474 merged miss-islington, 2020-02-12 03:36
Messages (5)
msg361780 - (view) Author: Andy Lester (petdance) * Date: 2020-02-11 04:45
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);

* 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.
msg361859 - (view) Author: Benjamin Peterson (benjamin.peterson) * (Python committer) Date: 2020-02-12 02:28
New changeset e6be9b59a911626d6597fe148c32f0342bd2bd24 by Andy Lester in branch 'master':
closes bpo-39605: Fix some casts to not cast away const. (GH-18453)
https://github.com/python/cpython/commit/e6be9b59a911626d6597fe148c32f0342bd2bd24
msg361860 - (view) Author: miss-islington (miss-islington) Date: 2020-02-12 02:47
New changeset 190433d8150bf719fa0ba972dbacf2214942f54e by Miss Islington (bot) in branch '3.8':
closes bpo-39605: Fix some casts to not cast away const. (GH-18453)
https://github.com/python/cpython/commit/190433d8150bf719fa0ba972dbacf2214942f54e
msg361863 - (view) Author: Benjamin Peterson (benjamin.peterson) * (Python committer) Date: 2020-02-12 03:36
New changeset 95905ce0f41fd42eb1ef60ddb83f057401c3d52f by Benjamin Peterson in branch 'master':
bpo-39605: Remove a cast that causes a warning. (GH-18473)
https://github.com/python/cpython/commit/95905ce0f41fd42eb1ef60ddb83f057401c3d52f
msg361864 - (view) Author: miss-islington (miss-islington) Date: 2020-02-12 03:52
New changeset 0b8f738eb3ee0110461e7da28c0b6b452f91999d by Miss Islington (bot) in branch '3.8':
bpo-39605: Remove a cast that causes a warning. (GH-18473)
https://github.com/python/cpython/commit/0b8f738eb3ee0110461e7da28c0b6b452f91999d
History
Date User Action Args
2022-04-11 14:59:26adminsetgithub: 83786
2020-02-12 03:52:53miss-islingtonsetmessages: + msg361864
2020-02-12 03:36:28miss-islingtonsetpull_requests: + pull_request17842
2020-02-12 03:36:21benjamin.petersonsetmessages: + msg361863
2020-02-12 03:07:01benjamin.petersonsetpull_requests: + pull_request17841
2020-02-12 02:47:27miss-islingtonsetnosy: + miss-islington
messages: + msg361860
2020-02-12 02:28:49miss-islingtonsetpull_requests: + pull_request17839
2020-02-12 02:28:44benjamin.petersonsetstatus: open -> closed

nosy: + benjamin.peterson
messages: + msg361859

resolution: fixed
stage: patch review -> resolved
2020-02-11 04:48:08petdancesetkeywords: + patch
stage: patch review
pull_requests: + pull_request17827
2020-02-11 04:45:37petdancecreate