Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Correct __sizeof__ support for itertools #59680

Closed
serhiy-storchaka opened this issue Jul 27, 2012 · 12 comments
Closed

Correct __sizeof__ support for itertools #59680

serhiy-storchaka opened this issue Jul 27, 2012 · 12 comments
Assignees
Labels
stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error

Comments

@serhiy-storchaka
Copy link
Member

BPO 15475
Nosy @birkenfeld, @rhettinger, @jcea, @meadori, @serhiy-storchaka
Files
  • itertools_sizeof-3.3.patch: Patch for 3.3
  • itertools_sizeof-3.2.patch: Patch for 3.2
  • itertools_sizeof-2.7.patch: Patch for 2.7
  • itertools_sizeof-3.3-2.patch: Patch for 3.3
  • itertools_sizeof-3.2-2.patch: Patch for 3.2
  • itertools_sizeof-2.7-2.patch: Patch for 2.7
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = 'https://github.com/serhiy-storchaka'
    closed_at = <Date 2013-12-09.15:58:05.453>
    created_at = <Date 2012-07-27.19:44:01.998>
    labels = ['type-bug', 'library']
    title = 'Correct __sizeof__ support for itertools'
    updated_at = <Date 2013-12-09.15:58:05.453>
    user = 'https://github.com/serhiy-storchaka'

    bugs.python.org fields:

    activity = <Date 2013-12-09.15:58:05.453>
    actor = 'serhiy.storchaka'
    assignee = 'serhiy.storchaka'
    closed = True
    closed_date = <Date 2013-12-09.15:58:05.453>
    closer = 'serhiy.storchaka'
    components = ['Library (Lib)']
    creation = <Date 2012-07-27.19:44:01.998>
    creator = 'serhiy.storchaka'
    dependencies = []
    files = ['26547', '26548', '26549', '26576', '26577', '26578']
    hgrepos = []
    issue_num = 15475
    keywords = ['patch', 'needs review']
    message_count = 12.0
    messages = ['166603', '166780', '166781', '167682', '167689', '170564', '170574', '170577', '170578', '170609', '199359', '205707']
    nosy_count = 7.0
    nosy_names = ['georg.brandl', 'rhettinger', 'jcea', 'meador.inge', 'python-dev', 'aliles', 'serhiy.storchaka']
    pr_nums = []
    priority = 'low'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue15475'
    versions = ['Python 3.4']

    @serhiy-storchaka
    Copy link
    Member Author

    Here is a patch that implements correct __sizeof__ for some itertools iterators: product(), combinations(), combinations_with_replacement() and permutations().

    @serhiy-storchaka serhiy-storchaka added stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error labels Jul 27, 2012
    @serhiy-storchaka
    Copy link
    Member Author

    Patches updated on Meador's remarks. Tests updated to use new test.support helpers.

    @serhiy-storchaka
    Copy link
    Member Author

    Sorry, on Martin's remarks.

    @rhettinger rhettinger self-assigned this Aug 8, 2012
    @rhettinger
    Copy link
    Contributor

    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.

    @rhettinger rhettinger removed their assignment Aug 8, 2012
    @meadori
    Copy link
    Member

    meadori commented Aug 8, 2012

    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.

    @meadori meadori self-assigned this Aug 8, 2012
    @serhiy-storchaka
    Copy link
    Member Author

    Are there any objections?

    @birkenfeld
    Copy link
    Member

    Certainly not for 3.3.0. I'm also not sure this counts as a bugfix in any case.

    @serhiy-storchaka
    Copy link
    Member Author

    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?

    @birkenfeld
    Copy link
    Member

    Ah, sorry, that was unclear. I meant "this is certainly not going into 3.3.0."

    @meadori
    Copy link
    Member

    meadori commented Sep 17, 2012

    Unassigning from myself. I thought I would have more time to review and push this through.

    @meadori meadori removed their assignment Sep 17, 2012
    @serhiy-storchaka serhiy-storchaka self-assigned this Dec 29, 2012
    @rhettinger
    Copy link
    Contributor

    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.

    @python-dev
    Copy link
    Mannequin

    python-dev mannequin commented Dec 9, 2013

    New changeset 9bce03920afe by Serhiy Storchaka in branch 'default':
    Issue bpo-15475: Add __sizeof__ implementations for itertools objects.
    http://hg.python.org/cpython/rev/9bce03920afe

    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error
    Projects
    None yet
    Development

    No branches or pull requests

    4 participants