You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
New changeset d7c7add by Victor Stinner (Zac Hatfield-Dodds) in branch 'master': bpo-12159: Document sys.maxsize limit in len() function reference (GH-17934) d7c7add
Activity
peterfankhaenel commentedon May 23, 2011
An OverflowError is emitted in case the return value of __len__
exceeds 2**31-1.
The following code:
len (c)
# leads to an OverflowError in the last line. It works flawless for
c.__len__ ()
benjaminp commentedon May 23, 2011
Yep, len() has to return something less than sys.maxsize.
vstinner commentedon May 23, 2011
len(obj) is implemented using PyObject_Size() which is stores the result into a Py_ssize_t, and so is limited to sys.maxsize (2**31-1 or 2**63-1).
This implementation detail should be documented.
vstinner commentedon Jan 12, 2020
New changeset d7c7add by Victor Stinner (Zac Hatfield-Dodds) in branch 'master':
bpo-12159: Document sys.maxsize limit in len() function reference (GH-17934)
d7c7add