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.

classification
Title: Correct __sizeof__ support for itertools
Type: behavior Stage: resolved
Components: Library (Lib) Versions: Python 3.4
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: serhiy.storchaka Nosy List: aliles, georg.brandl, jcea, meador.inge, python-dev, rhettinger, serhiy.storchaka
Priority: low Keywords: needs review, patch

Created on 2012-07-27 19:44 by serhiy.storchaka, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
itertools_sizeof-3.3.patch serhiy.storchaka, 2012-07-27 19:44 Patch for 3.3 review
itertools_sizeof-3.2.patch serhiy.storchaka, 2012-07-27 19:45 Patch for 3.2 review
itertools_sizeof-2.7.patch serhiy.storchaka, 2012-07-27 19:46 Patch for 2.7 review
itertools_sizeof-3.3-2.patch serhiy.storchaka, 2012-07-29 16:11 Patch for 3.3 review
itertools_sizeof-3.2-2.patch serhiy.storchaka, 2012-07-29 16:12 Patch for 3.2 review
itertools_sizeof-2.7-2.patch serhiy.storchaka, 2012-07-29 16:12 Patch for 2.7 review
Messages (12)
msg166603 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2012-07-27 19:44
Here is a patch that implements correct __sizeof__ for some itertools iterators: product(), combinations(), combinations_with_replacement() and permutations().
msg166780 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2012-07-29 16:11
Patches updated on Meador's remarks. Tests updated to use new test.support helpers.
msg166781 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2012-07-29 16:13
Sorry, on Martin's remarks.
msg167682 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2012-08-08 10:41
The clean-up patch looks much nicer.  Thanks.

I'm not sure why anyone would really want this functionality for itertools, but I don't see any harm in adding it as long as the other implementations aren't required to follow.

Also, it could be viewed as being a new feature, so I'm not sure backports are warranted.  Be sure to ask the respective release managers before applying.
msg167689 - (view) Author: Meador Inge (meador.inge) * (Python committer) Date: 2012-08-08 14:09
On Wed, Aug 8, 2012 at 5:41 AM, Raymond Hettinger <report@bugs.python.org> wrote:

> I'm not sure why anyone would really want this functionality for itertools,
> but I don't see any harm in adding it as long as the other implementations
> aren't required to follow.

The general expection is that __sizeof__ is for CPython.  We tag the tests
with '@cpython_only'.

> Also, it could be viewed as being a new feature, so I'm not sure backports
> are warranted. 

So far, we have been applying the __sizeof__ patches to all branches.

> Be sure to ask the respective release managers before applying.

I will check with Georg for 3.3.  Thanks.
msg170564 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2012-09-16 18:35
Are there any objections?
msg170574 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2012-09-16 19:54
Certainly not for 3.3.0.  I'm also not sure this counts as a bugfix in any case.
msg170577 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2012-09-16 20:12
Georg, sorry, I don't understood you. You have no objection to the inclusion 
of this patch in 3.3.0 or you say that this patch should not be in 3.3.0?
msg170578 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2012-09-16 20:15
Ah, sorry, that was unclear.  I meant "this is certainly not going into 3.3.0."
msg170609 - (view) Author: Meador Inge (meador.inge) * (Python committer) Date: 2012-09-17 14:06
Unassigning from myself.  I thought I would have more time to review and push this through.
msg199359 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2013-10-10 05:13
Serhiy, you can make the decision on whether this goes into 3.4 or gets closed.

I don't think any actual user has ever expressed interest in this functionality and it is hard to meaningfully reason about the real memory cost because we don't have a way to include the memory of the referred-to objects.  To me, it seems like unnecessary code bloat.
msg205707 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2013-12-09 15:46
New changeset 9bce03920afe by Serhiy Storchaka in branch 'default':
Issue #15475: Add __sizeof__ implementations for itertools objects.
http://hg.python.org/cpython/rev/9bce03920afe
History
Date User Action Args
2022-04-11 14:57:33adminsetgithub: 59680
2013-12-09 15:58:05serhiy.storchakasetstatus: open -> closed
resolution: fixed
stage: patch review -> resolved
2013-12-09 15:46:02python-devsetnosy: + python-dev
messages: + msg205707
2013-10-10 05:13:36rhettingersetassignee: rhettinger -> serhiy.storchaka
messages: + msg199359
2013-09-20 23:56:11rhettingersetassignee: serhiy.storchaka -> rhettinger
versions: - Python 2.7, Python 3.2, Python 3.3
2013-09-19 10:49:20serhiy.storchakaunlinkissue19048 superseder
2013-09-19 10:43:16serhiy.storchakalinkissue19048 superseder
2012-12-29 22:23:37serhiy.storchakasetassignee: serhiy.storchaka
2012-10-04 10:46:17jceasetnosy: + jcea
2012-10-02 16:47:11serhiy.storchakasetversions: + Python 3.4
2012-09-17 14:06:48meador.ingesetassignee: meador.inge -> (no value)
messages: + msg170609
2012-09-16 20:15:39georg.brandlsetmessages: + msg170578
2012-09-16 20:12:48serhiy.storchakasetmessages: + msg170577
2012-09-16 19:54:43georg.brandlsetmessages: + msg170574
2012-09-16 18:35:00serhiy.storchakasetnosy: + georg.brandl
messages: + msg170564
2012-08-29 11:35:01alilessetnosy: + aliles
2012-08-08 14:09:45meador.ingesetassignee: meador.inge
messages: + msg167689
2012-08-08 10:41:32rhettingersetassignee: rhettinger -> (no value)
messages: + msg167682
2012-08-08 07:59:04rhettingersetpriority: normal -> low
assignee: rhettinger
2012-08-05 10:58:09serhiy.storchakasetkeywords: + needs review
stage: patch review
2012-07-29 16:13:49serhiy.storchakasetmessages: + msg166781
2012-07-29 16:12:45serhiy.storchakasetfiles: + itertools_sizeof-2.7-2.patch
2012-07-29 16:12:15serhiy.storchakasetfiles: + itertools_sizeof-3.2-2.patch
2012-07-29 16:11:28serhiy.storchakasetfiles: + itertools_sizeof-3.3-2.patch

messages: + msg166780
2012-07-29 03:41:03meador.ingesetnosy: + meador.inge
2012-07-27 19:46:13serhiy.storchakasetfiles: + itertools_sizeof-2.7.patch
2012-07-27 19:45:38serhiy.storchakasetfiles: + itertools_sizeof-3.2.patch
2012-07-27 19:44:02serhiy.storchakacreate