[issue7298] reversed(range(x, -1, -1)) is empty when x > 1

Mark Dickinson report at bugs.python.org
Sun Nov 15 13:41:02 CET 2009


Mark Dickinson <dickinsm at gmail.com> added the comment:

Backported the tests and some of the fixes to 2.x in r76295 (trunk) and 
r76296 (release26-maint).

2.x seems to have been producing correct results in all cases on my 
machine.  The only problem on 2.x was that the code depended on signed 
arithmetic wrapping modulo 2**width (undefined behaviour!  very bad!);  
now it only depends on unsigned -> signed conversions wrapping modulo 
2**width, which still isn't guaranteed by the C standards, but it's 
merely implementation-defined behaviour rather than undefined behaviour, 
and all implementations that I'm aware of do this.

----------
resolution:  -> fixed
status: open -> closed

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue7298>
_______________________________________


More information about the Python-bugs-list mailing list