[issue46361] Small ints aren't always cached properly
Mark Dickinson
report at bugs.python.org
Thu Jan 13 03:53:24 EST 2022
Mark Dickinson <dickinsm at gmail.com> added the comment:
And there are some similar things going on in rangeobject.c.
https://github.com/python/cpython/blob/1de60155d5d01be2924e72fb68dd13d4fd00acd7/Objects/rangeobject.c#L598
if (r->step == _PyLong_GetOne()) {
return idx;
}
Again, technically "okay", since it's only a fast path and the slow path that follows will still do the right thing with a 1 that's not "the" 1, but it feels fragile.
----------
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue46361>
_______________________________________
More information about the Python-bugs-list
mailing list