Skip to content

gh-124397: Add free-threading support for iterators.#148894

Open
rhettinger wants to merge 8 commits intopython:mainfrom
rhettinger:iterator_synchronization
Open

gh-124397: Add free-threading support for iterators.#148894
rhettinger wants to merge 8 commits intopython:mainfrom
rhettinger:iterator_synchronization

Conversation

@rhettinger
Copy link
Copy Markdown
Contributor

@rhettinger rhettinger commented Apr 22, 2026

@rhettinger rhettinger added the type-feature A feature request or enhancement label Apr 22, 2026
@rhettinger rhettinger changed the title Issue-124397: Add free-threading support for iterators. gh-124397: Add free-threading support for iterators. Apr 22, 2026
@rhettinger rhettinger marked this pull request as draft April 22, 2026 22:39
@rhettinger rhettinger requested a review from colesbury April 23, 2026 02:00
@rhettinger rhettinger force-pushed the iterator_synchronization branch from 21fca13 to 4c2bad0 Compare April 23, 2026 02:33
@rhettinger rhettinger marked this pull request as ready for review April 23, 2026 02:52
Copy link
Copy Markdown
Contributor

@colesbury colesbury left a comment

Choose a reason for hiding this comment

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

LGTM

Comment thread Doc/library/threading.rst

import threading

source = range(5)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This doesn't seem like a very compelling example because range() you can iterate over range concurrent from multiple threads already.

Maybe something like a simple generator would be more useful as an example?

Comment thread Doc/library/threading.rst

.. doctest::

import threading
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Needs >>> for doctest to run. Alternatively, use .. code-block:: python

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants