Martin Panter added the comment:

Serhiy: slice-step.patch seems to be fine with negative slice steps. The actual 
indexes are still positive, and “unsigned” arithmetic is really modular 
arithmetic, so when you add the negative “unsigned” step value, it decrements 
the index properly.
Antti: if you use the sanitizer, (almost?) all the shift errors are for left 
shifts, either of a positive signed overflow, or a negative value. There is a 
bit more discussion of bit shift errors in Issue 20932. Examples:

Modules/audioop.c:1527:43: runtime error: left shift of negative value -24
Objects/unicodeobject.c:5152:29: runtime error: left shift of 255 by 24 places 
cannot be represented in type 'int'

I didn’t see any sanitizer reports about right shifts; perhaps it doesn’t 
report those (being implemenation-defined, rather than undefined, behaviour). 
And the only report about an excessive shift size is due to a known bug in 
ctypes, Issue 15119.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue1621>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to