Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gh-103092: Isolate socket #103094

Merged
merged 24 commits into from
Apr 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
4a7c6d9
Establish global state
erlend-aasland Mar 11, 2023
220a0aa
Add sock_type to state
erlend-aasland Mar 12, 2023
94ca00c
Add exceptions to state
erlend-aasland Mar 12, 2023
fc9cdce
Add accept4_works to state
erlend-aasland Mar 12, 2023
29b4d1c
Add sock_cloexec_works to state
erlend-aasland Mar 12, 2023
93a2b62
Add defaulttimeout to state
erlend-aasland Mar 12, 2023
4164f96
Refactor: replace state query with param in set_herror()
erlend-aasland Mar 12, 2023
dc740d1
Refactor: replace state query with param in set_gaierror()
erlend-aasland Mar 12, 2023
abf00c3
Refactor: replace state query with param in new_sockobject()
erlend-aasland Mar 12, 2023
9c1c9c6
Refactor: replace state query with param in init_sockobject()
erlend-aasland Mar 12, 2023
82c00c4
Refactor: replace state query with param in gethost_common()
erlend-aasland Mar 12, 2023
72e69e3
Refactor: replace state query with param in sock_get_api()
erlend-aasland Mar 12, 2023
274c412
Refactor: replace state query with param in setipaddr()
erlend-aasland Mar 12, 2023
d839af0
Add state pointer to PySocketSockObject
erlend-aasland Mar 12, 2023
13d14da
Use sock pointer from sock type context where applicable
erlend-aasland Mar 12, 2023
b4edf64
Multi-phase init
erlend-aasland Mar 12, 2023
c51a696
Remove unneeded forward decl
erlend-aasland Mar 30, 2023
d8e448f
Add test
erlend-aasland Mar 30, 2023
4332571
fixup dealloc
erlend-aasland Mar 30, 2023
6a00c54
Add NEWS
erlend-aasland Apr 3, 2023
e5027c2
Style: remove unneeded parens
erlend-aasland Apr 4, 2023
98d1566
Pull in main
erlend-aasland Apr 4, 2023
e5827e7
Sync with main
erlend-aasland Apr 8, 2023
2019a93
Simplify ADD_EXC macro further
erlend-aasland Apr 8, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions Lib/test/test_socket.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import array
import contextlib
import errno
import gc
import io
import itertools
import math
Expand Down Expand Up @@ -836,6 +837,12 @@ def requireSocket(*args):

class GeneralModuleTests(unittest.TestCase):

@unittest.skipUnless(_socket is not None, 'need _socket module')
def test_socket_type(self):
self.assertTrue(gc.is_tracked(_socket.socket))
with self.assertRaisesRegex(TypeError, "immutable"):
_socket.socket.foo = 1

def test_SocketType_is_socketobject(self):
import _socket
self.assertTrue(socket.SocketType is _socket.socket)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Isolate :mod:`!_socket` (apply :pep:`687`). Patch by Erlend E. Aasland.
Loading