classification
Title: _Py_HashPointer's void * argument should be const
Type: enhancement Stage: resolved
Components: Interpreter Core Versions: Python 3.9
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: petdance, serhiy.storchaka
Priority: normal Keywords: patch

Created on 2019-12-24 04:43 by petdance, last changed 2020-03-07 04:00 by benjamin.peterson. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 17690 merged petdance, 2019-12-24 05:01
Messages (3)
msg358839 - (view) Author: Andy Lester (petdance) * Date: 2019-12-24 04:43
_Py_HashPointer in Python/pyhash.c takes a pointer argument that can be made const.  This will let compiler and static analyzers know that the pointer's target is not modified.  You can also change calls to _Py_HashPointer that are down-casting pointers.

For example, in meth_hash in Objects/methodobject.c, this call can have the void * changed to const void *.

    y = _Py_HashPointer((void*)(a->m_ml->ml_meth));
msg361455 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2020-02-05 21:10
New changeset 3d06953c34fd6421dd1dfdb615578cde676ee0eb by Andy Lester in branch 'master':
bpo-39127: Make _Py_HashPointer's argument be const (GH-17690)
https://github.com/python/cpython/commit/3d06953c34fd6421dd1dfdb615578cde676ee0eb
msg363560 - (view) Author: Andy Lester (petdance) * Date: 2020-03-06 21:44
Is there more to do here or can it be closed?
History
Date User Action Args
2020-03-07 04:00:50benjamin.petersonsetstatus: open -> closed
resolution: fixed
stage: patch review -> resolved
2020-03-06 21:44:52petdancesetmessages: + msg363560
2020-02-05 21:10:05serhiy.storchakasetnosy: + serhiy.storchaka
messages: + msg361455
2020-02-05 11:04:44terry.reedysettype: enhancement
versions: + Python 3.9
2019-12-24 05:01:40petdancesetkeywords: + patch
stage: patch review
pull_requests: + pull_request17145
2019-12-24 04:43:00petdancecreate