gh-124397: Add free-threading support for iterators.#148894
gh-124397: Add free-threading support for iterators.#148894rhettinger wants to merge 16 commits intopython:mainfrom
Conversation
21fca13 to
4c2bad0
Compare
Documentation build overview
15 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 |
📚 Documentation preview 📚: https://cpython-previews--148894.org.readthedocs.build/