socket: vendor Lib/socket.py and drop the bogus _socket.makefile stub#48
Merged
Conversation
Owner
Author
|
All six checks green on the second push:
The CI workflow now also gives every step a human-readable |
CPython splits socket into two layers: Modules/socketmodule.c (the low-level _socket primitives) plus Lib/socket.py (the public class that wraps _socket.socket and adds makefile, create_connection, SocketIO, the AF_/SOCK_/MSG_/AI_ IntEnum promotion, etc.). gopy had half of the lower layer and a hand-rolled NotImplementedError stub where makefile should be. This vendors Lib/socket.py verbatim and adds a redirect shim under module/socket/ so PathFinder serves it; the makefile stub on the _socket type goes away because that method has never lived in Modules/socketmodule.c. Also pulls in os._get_exports_list because socket.py needs it during IntEnum._convert_ promotion.
4c77076 to
aeb9bc3
Compare
Flip rows whose ports actually landed: - types: all five descriptor types resolve via type(...) in stdlib/types.py - dataclasses: make_dataclass/order/slots/InitVar all in module/dataclasses - VM / compile audit: three sweeps closed (#586/#587/#588) - socket: new row for the Lib/socket.py vendor on top of _socket - VM audit sub-table rows A/B/C: pending -> done Refresh notes on the remaining partial rows (_colorize, functools, pprint, time, traceback) to match the current blocker shape, and add a top-level Checklist so the at-a-glance view stays current.
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
CPython splits socket across two layers:
Modules/socketmodule.cfor the low-level_socketprimitives andLib/socket.pyfor the user-facing class that wraps_socket.socketwithmakefile,SocketIO,create_connection,create_server, and theAF_*/SOCK_*/MSG_*/AI_*IntEnum promotion. We had the lower layer and a hand-rolledNotImplementedErrorstub wheremakefileshould live.This vendors
Lib/socket.pyverbatim understdlib/, adds the redirect shim atmodule/socket/module.goso PathFinder serves it, and removes thesockMakefilestub from_socket(the method has never been part ofsocketmodule.c).While wiring it up I had to add
os._get_exports_listtomodule/os/module.gobecausesocket.pycalls it during theIntEnum._convert_promotion ofAF_*/SOCK_*integers. Direct port ofLib/os.py:44.Test plan
go build ./...go vet ./...go test ./stdlibinit/ -run TestImportSocket -vcoversimport socket,AF_INETinteger equivalence,SocketKind.SOCK_STREAM.name, and theAddressFamilyenum typego test ./...(only pre-existing macOS-only lexer parity skip onbytecodes.ctoken count)