This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author josh.r
Recipients josh.r, p-ganssle
Date 2021-10-08.19:45:21
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1633722321.3.0.292756370253.issue45414@roundup.psfhosted.org>
In-reply-to
Content
"We'll definitely want to make sure that we're careful about bad indices ... since it would be easy to get weird behavior where too-large negative indexes start 'wrapping around'"

When I noticed the problem, I originally thought "Hey, the test for a negative index can come *before* the range check and save some work for negative indices". Then I realized, while composing this bug report, that that would make p.parents[-4] with len(p.parents) == 3 → p.parents[-1] as you said, and die with a RecursionError for p.parents[-3000] or so. I'm going to ignore the possibility I'm sleep-deprived and/or sloppy, and assume a lot of good programmers would think to make that "optimization" and accidentally introduce new bugs. :-) So yeah, all the tests.
History
Date User Action Args
2021-10-08 19:45:21josh.rsetrecipients: + josh.r, p-ganssle
2021-10-08 19:45:21josh.rsetmessageid: <1633722321.3.0.292756370253.issue45414@roundup.psfhosted.org>
2021-10-08 19:45:21josh.rlinkissue45414 messages
2021-10-08 19:45:21josh.rcreate