Repository navigation
Start autoimport cache workers without forking a threaded process - #964
Open
marlon-costa-dc wants to merge 3 commits into
Open
marlon-costa-dc wants to merge 3 commits into
marlon-costa-dc wants to merge 3 commits into
Conversation
`AutoImport.generate_cache` and `generate_modules_cache` used the platform's default process start method, which is `fork` on POSIX before Python 3.14. Forking a process that runs other threads, as editors, language servers and test runners do, can deadlock the child, and Python 3.12+ warns on every such fork. Start the pool's workers with `forkserver`, or `spawn` where it is unavailable. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #964 +/- ##
=======================================
Coverage 95.44% 95.45%
=======================================
Files 134 134
Lines 26910 26942 +32
=======================================
+ Hits 25685 25717 +32
Misses 1225 1225 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
On macOS the recorded warnings also held `ResourceWarning: unclosed database` for sqlite connections other tests leave to the garbage collector. The test is about forking a threaded process, so assert that no "use of fork()" warning appears. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
Author
|
The upstream test workflows wait for maintainer approval on fork PRs. For reference, this head passed the fork's full CI test matrix, macOS included (the first run caught an over-broad assertion that also recorded unrelated sqlite ResourceWarnings; the test now checks only the fork-with-threads warning): https://github.com/marlon-costa-dc/rope/actions/runs/44977474839 |
This branch has not been deployed
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.
AutoImport.generate_cacheandgenerate_modules_cacherun their workers in aProcessPoolExecutorwith the platform's default start method, which isforkon POSIX before Python 3.14. Forking a process that runs other threads, as editors, language servers and test runners usually do, can deadlock the child, and Python 3.12+ emits aDeprecationWarningon every such fork.This starts the pool's workers with
forkserver(the POSIX default since Python 3.14), orspawnwhereforkserveris unavailable, through one_process_pool()helper used by both call sites.The new test selects the
forkstart method, starts a helper thread and generates both caches, asserting that no "use of fork()" warning is raised and the cache still answers searches.Local run (CPython 3.13):
ropetest/contrib/autoimport44 passed; the one error,test_get_package_tuple_compiled, comes from that interpreter's statically linked_sqlite3and is unrelated. pre-commit passes.🤖 Generated with Claude Code