Repository navigation
Conversation
The client is used from multi-threaded programs, and the GIL can hide race conditions. Add one job that runs the unit tests on free-threaded 3.14t with PYTHON_GIL=0, after checking that the GIL really is off. The job installs with pip, because the tests need only the package and pook. Add a test that shares one RESTClient between 16 threads against a local server that echoes each request back. It checks that every response answers its own request, including the per-request edge headers, that the threads really overlapped, and that per-request headers never reach the client's default headers.
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: true
Comment |
This was referenced Oct 24, 2026
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.
Fixes #<issue: CI-FREE-THREADED>
Builds on #9: without it, leaked pook mocks intercept the new test's requests. (#13 guards against the same leak inline because it cannot assume #9.)
A
RESTClientis shared between threads often enough that massive-com#1040 addedmaxsize=for it and the README's Network Configuration section covers the case;WebSocketClient.subscribe()is likewise called from other threads whileconnect()runs. Free-threaded Python (PEP 703) removes the GIL, which can hide race conditions. This adds one CI job on 3.14t and a test that shares oneRESTClientbetween threads.Unit test 3.14t (PYTHON_GIL=0):pip install -e . pook, fail unlesssys._is_gil_enabled()is false, then runtest_restandtest_websocketasmake testdoes.pyproject.tomlandpoetry.lockare unchanged. The job usesactions/setup-python@v5, which understands the3.14tversion string; the existing matrix is untouched.test_rest/test_concurrency.py: 16 threads make 64 calls each through one client to a local echo server. It checks that:c.headers, which is unchanged;It calls
_get, which every endpoint uses, because endpoint methods currently also copyoptionsinto the query string (#<issue: F8>).Tests
make testandmake lintpass on 3.10 and 3.14._concat_headerswrites intoself.headers, and, on 3.14t, if per-request headers are visible to other threads even briefly.