Repository navigation
assess offline guard: allow socketpair's loopback connect on Windows (Fixes #5250) - #5253
Conversation
…rough (Fixes #5250) Windows has no native socketpair; CPython builds one from an AF_INET loopback listen + connect, which the guard refused, so two test_assess guard tests (and any socketpair user, e.g. asyncio) failed on every Windows job. The guard now exempts the calling thread only for the duration of socket.socketpair; direct loopback and network calls stay refused. Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
|
No description provided. |
|
PR #5253 @ c95ee7c: 2 failed check(s) == full-suite-matrix (windows-latest, 3.10, 2, 3, true, 25) (failure) -- real == full-suite-matrix (windows-latest, 3.12, 2, 2, true, 25) (failure) -- real |
Root cause
#5234's offline guard refuses every non-AF_UNIX
connect. Windows has no nativesocket.socketpair; CPython emulates it with an AF_INET loopback listen +connect, sosocket.socketpair()raisedOfflineViolationunder the guard. Run 38901093215: bothtest_assess.pyguard tests failed on every Windows job (3.10, 3.12), identical traceback throughsocket.py socketpair -> csock.connect -> offline.guarded. Not a flake. Linux/macOS have native socketpair, so they passed.Fix
offline.install()wrapssocket.socketpairto set a thread-local exemption for its duration (_allow_local). Direct loopback connects,create_connection,getaddrinfo,sendtostay refused.Tests
test_the_guard_exempts_only_socketpair_loopback: loopback connect refused, allowed inside_allow_local, refused again after,socketpair()works.Evidence
Local: guard tests pass;
pr_gates --fast6/6,--ratchets8/8. No golden impact (no parsing change).Sibling gaps
none (the existing docstring note on spawn-start workers on Windows/macOS lacking the guard is a separate #4726 follow-up).
Lessons for agents
A guard that wraps
socket.connectalso catches stdlib-internal loopback plumbing on Windows (socketpair); test socket guards on a Windows leg.🤖 Generated with Claude Code