cpython
cpython copied to clipboard
Remove dead code in _PyDict_GetItemHint
_PyDict_GetItemHint was an optimization that was subsequently made redundant.
So let's remove the dead code.
I am not removing _PyDict_GetItemHint completely here, because as far as I can tell it performs a different combination of error handling steps than the other ways to get items from a dict, and I don't feel confident rewriting the code in Python/specialize.c to work with the different assumptions around error handling.
So I am sticking with removing just the dead code, and a rename of the function (so that people get a proper error message when they are trying to still use the old version of _PyDict_GetItemHint).
If a reviewer has a hint for how to rewrite Python/specialize.c to use eg PyDict_GetItemWithError or PyDict_GetItem, I'd be more than happy to rewrite the PR. Thanks!
For future reference, if you force push then the reviewer has to re-review the whole PR. If you push normally, then the reviewer just needs to check the additional changes. This is a small PR, so it doesn't matter much here.
Have you checked that Cython doesn't use this API?
It has a leading underscore, so in theory, we are free to remove it. Isn't documented, and there are no tests for it. So we don't even know if works.
@scoder?
The function is not used by Cython.
For future reference, if you force push then the reviewer has to re-review the whole PR. If you push normally, then the reviewer just needs to check the additional changes. This is a small PR, so it doesn't matter much here.
Noted. Sorry. I left the commit that you had already seen alone, and only force-pushed an amendment to the new commit. I had assumed github would be smart enough to do the Right Thing. I guess it's not.
Thanks for pointing that out!
Thanks @matthiasgoergens
Thanks @matthiasgoergens
Thank you for the quick review, and patience with me forgetting one rename!
I'm just getting started with contributing.