fix(tools): support Python 3.14 worker context in DaemonThreadPoolExecutor (#76621) - #76756
Closed
Enough1122 wants to merge 1 commit into
Closed
fix(tools): support Python 3.14 worker context in DaemonThreadPoolExecutor (#76621)#76756Enough1122 wants to merge 1 commit into
Enough1122 wants to merge 1 commit into
Conversation
…cutor (NousResearch#76621) CPython 3.14 removed ThreadPoolExecutor._initializer/_initargs in favor of _create_worker_context(); the _worker signature became (executor_reference, ctx, work_queue). _adjust_thread_count read the removed attributes, so the first parallel tool batch crashed on 3.14. Branch on hasattr(self, '_create_worker_context') and pass the context object on 3.14+, keeping the 3.8-3.13 path unchanged.
Collaborator
Duplicate of #57459: both patches repair the Python 3.14 |
Contributor
|
Thanks for the focused compatibility repair. Current main still builds daemon workers with the legacy four-element tuple at Problems
Suggested changes
This is an automated hermes-sweeper review. |
Contributor
Author
This was referenced Aug 3, 2026
Open
Open
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
DaemonThreadPoolExecutor._adjust_thread_countmirrors CPython 3.8–3.13'sThreadPoolExecutorimplementation and readsself._initializer/self._initargs. CPython 3.14 removed those attributes in favor of_create_worker_context()(and changed_worker's signature to(executor_reference, ctx, work_queue)), so the first parallel tool batch on Python 3.14 crashed withAttributeError: 'DaemonThreadPoolExecutor' object has no attribute '_initializer'.Fix: branch on
hasattr(self, '_create_worker_context')— on 3.14+ pass the context object to_worker; on 3.8–3.13 the existing path is unchanged.Single-file change (plus one new test). No public API change. No new imports.
NOT doing X: not touching shutdown/idle-reuse semantics — daemon workers and
_threads_queuesskip are preserved on both branches.Test plan
Verified on Python 3.11 (3.8–3.13 branch). The 3.14 branch is exercised by the new unit test without depending on a 3.14 interpreter.