summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
Diffstat (limited to 'Lib')
-rw-r--r--Lib/ssl.py2
-rw-r--r--Lib/test/test_socket.py14
2 files changed, 10 insertions, 6 deletions
diff --git a/Lib/ssl.py b/Lib/ssl.py
index 7bcc67e..5e2da29 100644
--- a/Lib/ssl.py
+++ b/Lib/ssl.py
@@ -157,7 +157,7 @@ class SSLSocket(socket):
raise
else:
connected = True
- sock.forget()
+ sock.detach()
elif fileno is not None:
socket.__init__(self, fileno=fileno)
else:
diff --git a/Lib/test/test_socket.py b/Lib/test/test_socket.py
index ae34c11..a95e743 100644
--- a/Lib/test/test_socket.py
+++ b/Lib/test/test_socket.py
@@ -655,17 +655,21 @@ class BasicTCPTest(SocketConnectedTest):
self.serv_conn.send(MSG)
self.serv_conn.shutdown(2)
- def testForget(self):
- # Testing forget()
- f = self.cli_conn.fileno()
- self.cli_conn.forget()
+ def testDetach(self):
+ # Testing detach()
+ fileno = self.cli_conn.fileno()
+ f = self.cli_conn.detach()
+ self.assertEqual(f, fileno)
+ # cli_conn cannot be used anymore...
self.assertRaises(socket.error, self.cli_conn.recv, 1024)
self.cli_conn.close()
+ # ...but we can create another socket using the (still open)
+ # file descriptor
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM, fileno=f)
msg = sock.recv(1024)
self.assertEqual(msg, MSG)
- def _testForget(self):
+ def _testDetach(self):
self.serv_conn.send(MSG)
@unittest.skipUnless(thread, 'Threading required for this test.')