GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — `test_itertools.py` does not test infinite iterable for `itertools.chain.from_iterable` · Issue #93814 · python/cpython

test_itertools.py does not test infinite iterable for itertools.chain.from_iterable #93814

New issue
Copy link
New issue
Copy link
Closed
#93815
Closed
test_itertools.py does not test infinite iterable for itertools.chain.from_iterable#93814
#93815
Copy link
Assignees
rhettinger
Labels
testsTests in the Lib/test dirTests in the Lib/test dirtype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error

Description

@youknowone
youknowone
opened on Jun 14, 2022
Issue body actions

Bug report

itertools.chain.from_iterable is safe to use with infinite iterable, but no test exists.

example:

chain.from_iterable(repeat(range(5)))

Your environment

  • CPython versions tested on:
    3.10.4 and current main branch

  • Operating system and architecture:
    N/A

Activity

  1. youknowone
    added
    type-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
    on Jun 14, 2022
  2. AlexWaygood
    added
    testsTests in the Lib/test dirTests in the Lib/test dir
    on Jun 14, 2022
  3. AlexWaygood
    assigned
    rhettinger
    on Jun 14, 2022
  4. rhettinger commented on Jun 14, 2022

    @rhettinger
    rhettinger
    on Jun 14, 2022
    Contributor
    More actions

    ISTM there is no point in adding another test for this. Infinite iterators a just a special case of "bigger than you can reasonably consume".

    From a consumers point of view, there is no way to differentiate an infinite iterator from a huge iterator (c.f. the halting problem).

  5. youknowone commented on Jun 14, 2022

    @youknowone
    youknowone
    on Jun 14, 2022
    ContributorAuthor
    More actions

    The test will prevent a potential regression to evaluate given iterable before consuming.

    Please let me know if there is a test already covers a huge iterator.
    I found test_long_chain_of_empty_iterables is a similar one, but it doesn't fully prevent it.

    ref: RustPython/RustPython#3787

  6. miss-islington
    closed this as completedin #93815on Jun 14, 2022
  7. miss-islington
    added a commit that references this issue on Jun 14, 2022

    gh-93814: Add infinite test for itertools.chain.from_iterable (GH-93815)

    274769c
  8. serhiy-storchaka
    added a commit that references this issue on Jun 26, 2022

    Revert 30935 defer bpo45162 to 312 (#94285)

    1ffde3e
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

  • @rhettinger
    rhettinger

Labels

testsTests in the Lib/test dirTests in the Lib/test dirtype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    You are visitor 01402503 — GeezerVison does not store the pages you look up.
    Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.