Skip to content

Commit

Permalink
gh-103092: Isolate socket module (#103094)
Browse files Browse the repository at this point in the history
  • Loading branch information
erlend-aasland committed Apr 9, 2023
1 parent 3516704 commit f329a8b
Show file tree
Hide file tree
Showing 5 changed files with 242 additions and 167 deletions.
7 changes: 7 additions & 0 deletions Lib/test/test_socket.py
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
@@ -0,0 +1 @@
Isolate :mod:`!_socket` (apply :pep:`687`). Patch by Erlend E. Aasland.

0 comments on commit f329a8b

Please sign in to comment.