Repository navigation
Align socket and socketserver with Python 3.15 final - #9156
Conversation
Import the canonical socket libraries and tests through update_lib, preserving the existing AF_ALG expected failures. Match setsockopt index/buffer conversion and error ordering, mask optlen with the final CPython deprecation warning, reject oversized Windows buffers before the host call, and preserve arbitrary-precision getaddrinfo ports and empty canonical names. Assisted-by: OpenAI Codex:model version unavailable
|
Note Currently processing new changes in this PR. This may take a few minutes, please wait... ⚙️ Run configuration
⛔ Files ignored due to path filters: 4
📒 Files selected for processing: 1
✨ Finishing Touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
📦 Library DependenciesThe following Lib/ modules were modified. Here are their dependencies: :4: SyntaxWarning: invalid decimal literal dependencies:
dependent tests: (11 tests)
[ ] lib: cpython/Lib/threading.py dependencies:
dependent tests: (168 tests)
[x] lib: cpython/Lib/socket.py dependencies:
dependent tests: (103 tests)
[ ] test: cpython/Lib/test/test_bytes.py (TODO: 15) dependencies: dependent tests: (no tests depend on bytes) [x] test: cpython/Lib/test/test_thread.py (TODO: 1) dependencies: dependent tests: (14 tests) Legend:
|
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ed08422bea
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| with socket_setdefaulttimeout(10.125): | ||
| self.assertEqual(socket.getdefaulttimeout(), 10.125) |
There was a problem hiding this comment.
Keep the timeout test body unchanged
Do not land this imported test-body change: it changes timeout test data and assertions, while the repository policy permits test-file edits only for adding or removing expected-failure decorators. Keep this test body unchanged and validate the new behavior without modifying Lib/test.
AGENTS.md reference: AGENTS.md:L278-L282
Useful? React with 👍 / 👎.
Summary
Split the socket/socketserver portion of #8954 into five files, synchronized with CPython 3.15 final (
d220409a13b77de7a6c30abe16ea90db01528edc).socket.py,socketserver.py,test_socket.py, andtest_socketserver.pyusing the actualscripts/update_libcopy/migrate commands. Preserve all five existing AF_ALG expected-failure markers. No hand-edited library/test bodies, duplicate snippets, support-module changes, or workflows.setsockoptpositional parsing, index-before-buffer conversion, and error ordering. Python conversions, warnings, and buffer acquisition finish before the socket lock; the socket guard drops before the buffer export is released.optlensemantics beyond the original mega patch: use the index protocol, mask to unsigned 32 bits, and issueDeprecationWarning("integer value out of range")outside[-2**31, 2**32 - 1]. Warning-as-error propagates before the third-argument shape check or host call.INT_MAXbefore the host call.getaddrinfo, accept index objects before string/bytes handling, and return an empty canonical name when the resolver supplies none.Provenance and overlap
The three Python files other than
test_socket.pymatch the pinned CPython blobs byte-for-byte.test_socket.pydiffers only by the five retained AF_ALG decorators.The tested commit is retained rather than rebased over unrelated main changes. At publication, the main-relative PR patch still contains exactly the reviewed five files. #9143 remains open and adds an expected-failure marker to
test_getaddrinfo_int_port_overflow; that marker must be preserved if integrated because this run did not execute the real_testcapi-dependent body. The older socket overlap in #8007 concerns separate SSL/wait gating.Local validation
Normal commit hooks, the matching narrow release build, and strict stdlib/VM all-targets Clippy passed:
Eight unchanged canonical method extracts passed, each in a fresh bounded process:
test_socket.GeneralModuleTests:testDefaultTimeout,testGetSockOpt,testSetSockOpt,test_setsockopt_errors,test_SocketType_is_socketobject, andtestNewAttributestest_socketserver.TestModule.test_deprecated__version__test_socketserver.MiscTestCase.test_allFour temporary supplemental checks passed: numeric-only
getaddrinfoindex/type/boundary/canonical-name cases;setsockoptoptlen warnings and error order; a tiny native AF_UNIX socketpair/sendfile check; and socketserver attributes without starting a server. Every giant-optlen check supplied a non-None third argument and was rejected before host access. The sendfile fixture was 32 bytes, with 50 bytes transferred across the bounded cases; no external DNS was used.The additional canonical
test_getaddrinfo_int_port_overflownaturally skipped because the real_testcapimodule is absent. Its body remains untested; no fake module or constants were substituted.The runtime used the original library inventory with source/module-origin checks and time, memory, output, descriptor, and process limits. Initial missing native-math/IDNA admission failures were preserved, then corrected only in separately reviewed temporary import allowlists. No repository behavior or test assertion was changed to clear those gates. Source hashes remained unchanged across build, Clippy, and runtime, and an independent review checked the selected result receipts.
This is bounded Linux coverage, not a full
test_socket/test_socketserveror workspace-suite pass. Windows/macOS/BSD/WASI behavior, broad DNS/non-UTF8/SSL/AF_VSOCK parity, raw-device tests, and server/fork loops were not exercised. The Windows length guard was source-reviewed only.Validation identities:
ed08422bea7d1483a9a5a615870b7339a5dcc76be4493b63070d4578a60c1893273c5f791108a34d76781827730604d17b7c9624d44bdf898535141ef097c856552d332f1478443f69f14e515dc7307e1d2883169f31d781770839feaebe550240542bf4ac7d5f4f3d7e09f54c58b6977e0bf36dAI assistance
OpenAI Codex assisted with the implementation, canonical-source synchronization, source review, bounded validation, and this description. The exact model version was unavailable; the commit includes an
Assisted-bytrailer.