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 — gh-123884 Tee of tee was not producing n independent iterators by rhettinger · Pull Request #124490 · python/cpython

Conversation

@rhettinger

@rhettinger rhettinger commented Sep 25, 2024 •
edited by github-actions Bot
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor
  • Eliminates the code path that reused a tee object input as part of the output.
  • Updated the rough equivalent recipe to have better fidelity to the actual C code.
  • Removed a note about using the tee input. It is generically true of all iterator pass throughs and the note made it seem like a caution specific to tee where a tee-of-a-tee is the exception to the rule.
  • Issue: Incorrect optimization in itertools.tee() #123884

📚 Documentation preview 📚: https://cpython-previews--124490.org.readthedocs.build/

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
rhettinger added 4 commits September 24, 2024 14:12
@rhettinger
Working fix
6ce5cb0
@rhettinger
Clean-up unused path
2a7a4d3
@rhettinger
Update tee() rough equivalent recipe and related tests
e397bfd
@rhettinger
Add blurb
8e2315c
@rhettinger rhettinger added type-bug An unexpected behavior, bug, or error needs backport to 3.12 only security fixes needs backport to 3.13 only security fixes labels Sep 25, 2024
@bedevere-app bedevere-app Bot added the awaiting core review label Sep 25, 2024
@bedevere-app bedevere-app Bot mentioned this pull request Sep 25, 2024
Incorrect optimization in itertools.tee() #123884
Closed
rhettinger and others added 5 commits September 25, 2024 08:35
@rhettinger
Call tee_copy() directly
4e4fad4
@rhettinger
Merge branch 'main' into tee1
1a56697
@rhettinger
Beautify the pure python version
ee064e7
@rhettinger
Merge branch 'main' into tee1
f2f0a6e
@rhettinger
Remove unused __copy__ constant
6153e70
@rhettinger
rhettinger requested a review from ericvsmith September 25, 2024 19:08
ericvsmith
ericvsmith approved these changes Sep 25, 2024
View reviewed changes

@ericvsmith ericvsmith left a comment

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Other than the one noted nit, this all looks good to me. I verified the "roughly equivalent" code, but not the code in test_itertools.py (I figure the test suite will do that job).

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread Doc/library/itertools.rst Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread Lib/test/test_itertools.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

@bedevere-app bedevere-app Bot added awaiting merge and removed awaiting core review labels Sep 25, 2024
@rhettinger
rhettinger merged commit 909c6f7 into python:main Sep 25, 2024
@miss-islington-app

miss-islington-app Bot commented Sep 25, 2024

Copy link
Copy Markdown

Thanks @rhettinger for the PR 🌮🎉.. I'm working now to backport this PR to: 3.12, 3.13.
🐍🍒⛏🤖

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@bedevere-app bedevere-app Bot removed the awaiting merge label Sep 25, 2024
@miss-islington-app

miss-islington-app Bot commented Sep 25, 2024

Copy link
Copy Markdown

Sorry, @rhettinger, I could not cleanly backport this to 3.13 due to a conflict.
Please backport using cherry_picker on command line.

cherry_picker 909c6f718913e713c990d69e6d8a74c05f81e2c2 3.13
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@miss-islington-app miss-islington-app Bot assigned rhettinger Sep 25, 2024
@rhettinger
rhettinger deleted the tee1 branch September 25, 2024 20:38
@miss-islington-app

miss-islington-app Bot commented Sep 25, 2024

Copy link
Copy Markdown

Sorry, @rhettinger, I could not cleanly backport this to 3.12 due to a conflict.
Please backport using cherry_picker on command line.

cherry_picker 909c6f718913e713c990d69e6d8a74c05f81e2c2 3.12
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

emilyemorehouse added a commit to lysnikolaou/cpython that referenced this pull request Sep 26, 2024
@emilyemorehouse
Merge branch 'main' into fix-help-double-prompt
4cdb3ae
* main: (69 commits)
  Add "annotate" SET_FUNCTION_ATTRIBUTE bit to dis. (python#124566)
  pythongh-124412: Add helpers for converting annotations to source format (python#124551)
  pythongh-119180: Disallow instantiation of ConstEvaluator objects (python#124561)
  For-else deserves its own section in the tutorial (python#123946)
  Add 3.13 as a version option to the crash issue template (python#124560)
  pythongh-123242: Note that type.__annotations__ may not exist (python#124557)
  pythongh-119180: Make FORWARDREF format look at __annotations__ first (python#124479)
  pythonGH-58058: Add quick reference for `ArgumentParser` to argparse docs (pythongh-124227)
  pythongh-41431: Add `datetime.time.strptime()` and `datetime.date.strptime()` (python#120752)
  pythongh-102450: Add ISO-8601 alternative for midnight to `fromisoformat()` calls. (python#105856)
  pythongh-124370: Add "howto" for free-threaded Python (python#124371)
  pythongh-121277: Allow `.. versionadded:: next` in docs (pythonGH-121278)
  pythongh-119400:  make_ssl_certs: update reference test data automatically, pass in expiration dates as parameters python#119400  (pythonGH-119401)
  pythongh-119180: Avoid going through AST and eval() when possible in annotationlib (python#124337)
  pythongh-124448: Update Windows builds to use Tcl/Tk 8.6.15 (pythonGH-124449)
  pythongh-123884 Tee of tee was not producing n independent iterators (pythongh-124490)
  pythongh-124378: Update test_ttk for Tcl/Tk 8.6.15 (pythonGH-124542)
  pythongh-124513: Check args in framelocalsproxy_new() (python#124515)
  pythongh-101100: Add a table of class attributes to the "Custom classes" section of the data model docs (python#124480)
  Doc: Use ``major.minor`` for documentation distribution archive filenames (python#124489)
  ...
rhettinger added a commit to rhettinger/cpython that referenced this pull request Oct 8, 2024
@rhettinger
pythongh-123884 Tee of tee was not producing n independent iterators (p…
3509123
…ythongh-124490)
@picnixz picnixz removed needs backport to 3.12 only security fixes needs backport to 3.13 only security fixes labels Apr 5, 2025
@rhettinger rhettinger mentioned this pull request Aug 15, 2026
Incorrect optimization in itertools.tee() pypy/pypy#5563
Closed
@jseop-lim jseop-lim mentioned this pull request Oct 29, 2026
Fix itertools.tee() calling iter() and __copy__ unlike CPython 3.12 pypy/pypy#5702
Open
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@ericvsmith ericvsmith ericvsmith approved these changes

Uh oh!

There was an error while loading. Please reload this page.

Assignees

@rhettinger rhettinger

Labels

type-bug An unexpected behavior, bug, or error

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

3 participants

@rhettinger @ericvsmith @picnixz
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.