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 gdementen
Recipients docs@python, gdementen
Date 2015-03-12.15:24:35
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1426173876.09.0.220076074076.issue23645@psf.upfronthosting.co.za>
In-reply-to
Content
The documentation for __getslice__ at https://docs.python.org/2/reference/datamodel.html#object.__getslice__ states: "Note that missing i or j in the slice expression are replaced by zero or sys.maxint, respectively."

However, in practice, it seems like it is replaced by sys.maxsize instead. This is obviously only a problem for 64bit versions of Python 2 since sys.maxint and sys.maxsize are the same on 32bit Python.

In [1]: class A(object):
   ...:     def __getslice__(self, i, j):
   ...:         print i, j
   ...:

In [2]: a = A()

In [3]: a[:]
0 9223372036854775807

In [4]: import sys

In [5]: sys.maxint
Out[5]: 2147483647

In [6]: sys.maxsize
Out[6]: 9223372036854775807L

In [7]: sys.version
Out[7]: '2.7.9 |Continuum Analytics, Inc.| (default, Dec 18 2014, 16:57:52) [MSC v.1500 64 bit (AMD64)]'
History
Date User Action Args
2015-03-12 15:24:36gdementensetrecipients: + gdementen, docs@python
2015-03-12 15:24:36gdementensetmessageid: <1426173876.09.0.220076074076.issue23645@psf.upfronthosting.co.za>
2015-03-12 15:24:35gdementenlinkissue23645 messages
2015-03-12 15:24:35gdementencreate