Uh oh!
There was an error while loading. Please reload this page.
bpo-42222: Modernize integer test/conversion in randrange() - #23064
Conversation
serhiy-storchaka
left a comment
There was a problem hiding this comment.
Currently you are on the way to #19112 (which already has tests and documentation and cover corner cases).
This PR is stale because it has been open for 30 days with no activity. Remove stale label or comment or this will be closed in 5 days |
serhiy-storchaka
commented
Dec 24, 2020
What about #19112? |
rhettinger
commented
Dec 24, 2020
I merged in the relevant parts of #19112. The principal differences are:
|
serhiy-storchaka
commented
Dec 24, 2020
As in #19112 initially. I changed ValueError to TypeError on your request.
I would appreciate any suggestions to change wording.
Yes, tests in #19112 cover more cases.
As well as in #19112. But this PR still has issues. It does not emit warning for |
bedevere-bot
commented
Dec 28, 2020
@rhettinger: Please replace |
Moves the
int(x) == xtest and conversion into the C code for operator.index().Provides a 7% speed up:
It should become even faster when we get a zero-cost try.
It's odd that non-integers raise a ValueError. I think that should have been TypeError.
https://bugs.python.org/issue42222