[New-bugs-announce] [issue16030] xrange repr broken for large arguments

Mark Dickinson report at bugs.python.org
Mon Sep 24 23:23:17 CEST 2012


New submission from Mark Dickinson:

Python 2.7.3+ (2.7:f51d11405f1d+, Sep 24 2012, 21:39:19) 
[GCC 4.2.1 (Apple Inc. build 5664)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> xrange(0, sys.maxint, sys.maxint-1)
xrange(0, -4, 9223372036854775806)

See also issue #16029.  There should be a common solution to both these issues.  Suggestion is to write a 'range_safe_stop' utility function that returns r->start + r->len * r->step clipped to the range [LONG_MIN, LONG_MAX], and use that for the stop value in both the repr and the pickle.

----------
assignee: mark.dickinson
components: Library (Lib)
messages: 171193
nosy: mark.dickinson
priority: normal
severity: normal
stage: needs patch
status: open
title: xrange repr broken for large arguments
type: behavior
versions: Python 2.7

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


More information about the New-bugs-announce mailing list