[issue15718] Possible OverflowError in __len__ method undocumented (when called via len() function)

2020-01-10 Thread Zac Hatfield-Dodds


Change by Zac Hatfield-Dodds :


--
pull_requests: +17340
pull_request: https://github.com/python/cpython/pull/17934

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue15718] Possible OverflowError in __len__ method undocumented (when called via len() function)

2017-04-23 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
resolution:  -> fixed
stage: needs patch -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue15718] Possible OverflowError in __len__ method undocumented (when called via len() function)

2017-04-22 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:


New changeset bfc7dff63b9b30371e3423a5c35ccda2f3b52218 by Serhiy Storchaka in 
branch '2.7':
[2.7] bpo-15718: Document the upper bound constrain on the __len__ return 
value. (GH-1256). (#1261)
https://github.com/python/cpython/commit/bfc7dff63b9b30371e3423a5c35ccda2f3b52218


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue15718] Possible OverflowError in __len__ method undocumented (when called via len() function)

2017-04-22 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:


New changeset c358536fd5e40e8f29ee4f086588a82fccb25a09 by Serhiy Storchaka in 
branch '3.5':
[3.5] bpo-15718: Document the upper bound constrain on the __len__ return 
value. (GH-1256) (#1260)
https://github.com/python/cpython/commit/c358536fd5e40e8f29ee4f086588a82fccb25a09


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue15718] Possible OverflowError in __len__ method undocumented (when called via len() function)

2017-04-22 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:


New changeset f2ed2858eea7569c8915b3611ca5ec92ae10b17f by Serhiy Storchaka in 
branch '3.6':
[3.6] bpo-15718: Document the upper bound constrain on the __len__ return 
value. (GH-1256) (#1259)
https://github.com/python/cpython/commit/f2ed2858eea7569c8915b3611ca5ec92ae10b17f


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue15718] Possible OverflowError in __len__ method undocumented (when called via len() function)

2017-04-22 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
pull_requests: +1374

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue15718] Possible OverflowError in __len__ method undocumented (when called via len() function)

2017-04-22 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
pull_requests: +1373

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue15718] Possible OverflowError in __len__ method undocumented (when called via len() function)

2017-04-22 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
pull_requests: +1372

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue15718] Possible OverflowError in __len__ method undocumented (when called via len() function)

2017-04-22 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:


New changeset 85157cd89a6edac347a5b6871fcf20c500c6fbbf by Serhiy Storchaka in 
branch 'master':
bpo-15718: Document the upper bound constrain on the __len__ return value. 
(#1256)
https://github.com/python/cpython/commit/85157cd89a6edac347a5b6871fcf20c500c6fbbf


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue15718] Possible OverflowError in __len__ method undocumented (when called via len() function)

2017-04-22 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Yes, and the range object already is fixed by issue28876.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue15718] Possible OverflowError in __len__ method undocumented (when called via len() function)

2017-04-22 Thread Terry J. Reedy

Terry J. Reedy added the comment:

Has or will builtin classes be modified to follow advice to include a separate 
__bool__?  In 3.6.1,

>>> r = range(19**100)
>>> bool(r)
Traceback (most recent call last):
  File "", line 1, in 
bool(r)
OverflowError: Python int too large to convert to C ssize_t

--
nosy: +serhiy.storchaka
versions: +Python 3.7

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue15718] Possible OverflowError in __len__ method undocumented (when called via len() function)

2017-04-22 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
pull_requests: +1369

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue15718] Possible OverflowError in __len__ method undocumented (when called via len() function)

2016-01-01 Thread Terry J. Reedy

Changes by Terry J. Reedy :


--
versions: +Python 3.5, Python 3.6 -Python 3.2, Python 3.3

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue15718] Possible OverflowError in __len__ method undocumented (when called via len() function)

2016-01-01 Thread Martin Panter

Martin Panter added the comment:

Issue 10289 proposes to link from len() to __len__() in the documentation. I 
think the limitation only needs to be documented for __len__(); there are other 
ways to invoke it as well.

--
nosy: +martin.panter

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue15718] Possible OverflowError in __len__ method undocumented (when called via len() function)

2016-01-01 Thread Camilla Montonen

Camilla Montonen added the comment:

The deficiency noticed by Terry has been at least partially corrected in the 
len() docs
https://docs.python.org/2/library/functions.html#len
Return the length (the number of items) of an object. The argument may be a 
sequence (such as a string, bytes, tuple, list, or range) or a collection (such 
as a dictionary, set, or frozen set).

It doesn't mention the fact that the collection has to implement __len__, but I 
suppose that might be obvious to experienced Python users (isn't obvious to a 
beginner like me, though). So perhaps this might be a welcome clarification. 

The issue regarding OverflowError raised by Rostyslav still remains unresolved.

--
nosy: +Winterflower

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue15718] Possible OverflowError in __len__ method undocumented (when called via len() function)

2012-08-18 Thread Arfrever Frehtes Taifersar Arahesis

Changes by Arfrever Frehtes Taifersar Arahesis arfrever@gmail.com:


--
nosy: +Arfrever

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue15718
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue15718] Possible OverflowError in __len__ method undocumented (when called via len() function)

2012-08-17 Thread Rostyslav Dzinko

New submission from Rostyslav Dzinko:

I've encountered that OverflowError which can happen in __len__ method is still 
undocumented, though one issue on this problem: 
http://bugs.python.org/issue12159 ended up with need to be documented comment.

Link to documentation: 
http://docs.python.org/reference/datamodel.html#object.__len__

I think it must be clarified that __len__ return value is constrained to upper 
boundary (Py_ssize_t c type) when you plan to call it via len() built-in 
function.

--
assignee: docs@python
components: Documentation
messages: 168439
nosy: Rostyslav.Dzinko, docs@python
priority: normal
severity: normal
status: open
title: Possible OverflowError in __len__ method undocumented (when called via 
len() function)
versions: Python 2.7

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue15718
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue15718] Possible OverflowError in __len__ method undocumented (when called via len() function)

2012-08-17 Thread Rostyslav Dzinko

Changes by Rostyslav Dzinko rostislav.dzi...@gmail.com:


--
type:  - behavior

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue15718
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue15718] Possible OverflowError in __len__ method undocumented (when called via len() function)

2012-08-17 Thread Terry J. Reedy

Terry J. Reedy added the comment:

In #12159, Victor correctly labelled this an implementation (IE, CPython) 
detail (limitation). I don't believe any implementation has to limit the range 
of len(). So the question is whether we should add a CPython implementation 
limit note, including the possibility of OverflowError, and if so, to both 
len() and __len__() entries. I am not sure of the current doc policy.

The second sentence of the len entry is out of date.  The argument may be a 
sequence (string, tuple or list) or a mapping (dictionary). Sets and any 
collections with a size (__len__ method) can also be arguments. I am not sure 
how to revise that either.

--
nosy: +benjamin.peterson, georg.brandl, haypo, terry.reedy
stage:  - needs patch
versions: +Python 3.2, Python 3.3

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue15718
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com