[issue26423] __len__() returns 32 bit int on windows leading to overflows

2016-02-24 Thread Georg Brandl
Georg Brandl added the comment: You need to call `x.__len__()` explicitly. -- ___ Python tracker ___ ___

[issue26423] __len__() returns 32 bit int on windows leading to overflows

2016-02-24 Thread STINNER Victor
STINNER Victor added the comment: I tested Python 2.7 on Windows, downloaded from python.org: * 32-bit: - 'x'*(2**31+5) fails with OverflowError as expected - len('x' * (sys.maxsize // 2)) returns 2**30-1 as a Python int - for length larger with 'x' * (sys.maxsize // 2), I get a

[issue26423] __len__() returns 32 bit int on windows leading to overflows

2016-02-24 Thread Mark Dickinson
Mark Dickinson added the comment: > This is a 32-bit build ("win32"), no? No. "win32" appears for both 32-bit and 64-bit builds on Windows. This is a 64-bit build. `sys.maxint` is 2**31 - 1, and `sys.maxsize` is 2**63 - 1. They're not equal. I can reproduce the issue with a stock Python, on

[issue26423] __len__() returns 32 bit int on windows leading to overflows

2016-02-24 Thread STINNER Victor
STINNER Victor added the comment: > __len__() always returns an int which on windows machines is tied to the size > of a c long and is always 32 bits even if it's compiled for 64 bit. Hum, I don't understand this statement. It looks like the code uses Py_ssize_t everywhere and Py_ssize_t is

[issue26423] __len__() returns 32 bit int on windows leading to overflows

2016-02-24 Thread Mark Dickinson
Mark Dickinson added the comment: If I understand the report correctly, this affects Python 3, too. Adding 3.5 and 3.6 to the versions. -- nosy: +mark.dickinson versions: +Python 3.5, Python 3.6 ___ Python tracker

[issue26423] __len__() returns 32 bit int on windows leading to overflows

2016-02-23 Thread Frazer McLean
Changes by Frazer McLean : -- nosy: +RazerM ___ Python tracker ___ ___

[issue26423] __len__() returns 32 bit int on windows leading to overflows

2016-02-23 Thread Dave Hibbitts
New submission from Dave Hibbitts: __len__() always returns an int which on windows machines is tied to the size of a c long and is always 32 bits even if it's compiled for 64 bit. len() however returns an int for values less than sys.maxint and a long above that. Returning an int in