Skip to content

bpo-39127: Make _Py_HashPointer's argument be const#17690

Merged
serhiy-storchaka merged 298 commits into
python:masterfrom
petdance:const-_Py_HashPointer
Feb 5, 2020
Merged

bpo-39127: Make _Py_HashPointer's argument be const#17690
serhiy-storchaka merged 298 commits into
python:masterfrom
petdance:const-_Py_HashPointer

Conversation

@petdance

@petdance petdance commented Dec 24, 2019

Copy link
Copy Markdown
Contributor

_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));

https://bugs.python.org/issue39127

@the-knights-who-say-ni

Copy link
Copy Markdown

Hello, and thanks for your contribution!

I'm a bot set up to make sure that the project can legally accept this contribution by verifying everyone involved has signed the PSF contributor agreement (CLA).

CLA Missing

Our records indicate the following people have not signed the CLA:

@petdance

For legal reasons we need all the people listed to sign the CLA before we can look at your contribution. Please follow the steps outlined in the CPython devguide to rectify this issue.

If you have recently signed the CLA, please wait at least one business day
before our records are updated.

You can check yourself to see if the CLA has been received.

Thanks again for the contribution, we look forward to reviewing it!

@petdance

Copy link
Copy Markdown
Contributor Author

I have indeed signed the CLA, but it was just earlier this evening.

@petdance

Copy link
Copy Markdown
Contributor Author

@serhiy-storchaka If I find more instances of changes like this, should I submit each one individually, or put them all together in a single PR?

asottile and others added 19 commits February 4, 2020 21:00
Ignore leading dots and no longer ignore a trailing newline.
tkinter.ttk.Scale().configure([name]) now returns a configuration tuple for name
or a list thereof for all options. Based on patch Giovanni Lombardo.
Signed-off-by: Oleg Höfling <oleg.hoefling@gmail.com>
…s well (GH-17694)

To be consistent with document layout, it should say when the feature was added.
Although it's mentioned few other places in the doc but it's not explicitly say that at that place.


https://bugs.python.org/issue39130
…-17872)

* `enum.auto()` initial value is now specified as being `1`.
@terryjreedy

Copy link
Copy Markdown
Member

I verified that bpo has user petdance with petdance as the github name and with CLA marked signed. I don't know why the bot keeps adding back the unsigned label.

Properly merging the master into this (with git merge origin/master after updating local and origin/master and creating a pr branch) on my machine removed all but 1 of the spurious comments.

The latter was for a duplicate blurb for another issue, which I removed. I don't think that this needs a news item, but however merges can decide.

@terryjreedy

Copy link
Copy Markdown
Member

@serhiy-storchaka Do you want to merge as is or should Andy look for other places to add const?

@petdance

petdance commented Feb 5, 2020

Copy link
Copy Markdown
Contributor Author

Do you want to merge as is or should Andy look for other places to add const?

There are plenty of other places to add const. I suggest that they make the most sense on a case-by-case basis, and this should be merged as-is. I have another branch of constable candidates that I can start working on if this one works out OK.

@serhiy-storchaka

Copy link
Copy Markdown
Member

Sorry for the delay. I approved the PR, but I was going to look whether previous additions of const was documented in a NEWS file or elsewhere. I was not sure.

They did not. So this PR does not need a NEWS entry.

As for other places to add const, I want to look on them. I think there should not be much places where const can be added without breaking backward compatibility.

I am merging this PR now because it was open enough time and I do not want to lost it again. Thank you for your contribution @petdance.

@serhiy-storchaka serhiy-storchaka merged commit 3d06953 into python:master Feb 5, 2020
@petdance

petdance commented Feb 5, 2020

Copy link
Copy Markdown
Contributor Author

I'm glad to help. i'll keep looking for other constable functions. I've done lots of consting in the Perl core over the years.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.