gh-124397: Add free-threading support for iterators.#148894
gh-124397: Add free-threading support for iterators.#148894rhettinger merged 25 commits intopython:mainfrom
Conversation
21fca13 to
4c2bad0
Compare
Documentation build overview
69 files changed ·
|
|
I concur with @ZeroIntensity who wrote that For example, I would expect import threading
class Demo:
_next_id = 0
@threading.synchronized
def get_id(self):
self._next_id += 1
return self._next_idBut calling get_id() fails with:
|
|
Here are some GRASP-like thoughts on which module these should go into. These are only useful in the context of multithreaded programs. The threading module is where people look for tools to manage and synchronize concurrency conflicts. The implementation of the tools is almost entirely about lock management and synchronized result buffering. There is almost no logic that isn't threading related. In contrast, the itertools module is scoped to only include general purpose tools for creating iterators. Nothing in it has any thread management. Most of the tools are roughly equivalent to just a plain generator. |
|
I'd be able to live with these existing under If we're going to keep these under |
ZeroIntensity
left a comment
There was a problem hiding this comment.
Thanks for humoring me.
@vstinner, are you comfortable with this living under threading, as long as "iterator" is in the name?
ZeroIntensity
left a comment
There was a problem hiding this comment.
LGTM, thank you!
The failing CI is due to a Ubuntu outage.
Co-authored-by: Gregory P. Smith <68491+gpshead@users.noreply.github.com>
Co-authored-by: Gregory P. Smith <68491+gpshead@users.noreply.github.com>
Co-authored-by: Gregory P. Smith <68491+gpshead@users.noreply.github.com>
📚 Documentation preview 📚: https://cpython-previews--148894.org.readthedocs.build/