summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_socket.py
diff options
context:
space:
mode:
authorRaymond Hettinger <python@rcn.com>2004-05-31 03:09:25 (GMT)
committerRaymond Hettinger <python@rcn.com>2004-05-31 03:09:25 (GMT)
commit027bb633b6899a0847d81cb35cbccdff5a468766 (patch)
tree4d6694b894394f6dd73ed6eb7c8c47c1909f056d /Lib/test/test_socket.py
parentcb87bc8e7ee3a2ffd83dd1b12fcfa1c01aa740aa (diff)
downloadcpython-027bb633b6899a0847d81cb35cbccdff5a468766.zip
cpython-027bb633b6899a0847d81cb35cbccdff5a468766.tar.gz
cpython-027bb633b6899a0847d81cb35cbccdff5a468766.tar.bz2
Add weakref support to sockets and re pattern objects.
Diffstat (limited to 'Lib/test/test_socket.py')
-rw-r--r--Lib/test/test_socket.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/Lib/test/test_socket.py b/Lib/test/test_socket.py
index f7bf041..6e2f80c 100644
--- a/Lib/test/test_socket.py
+++ b/Lib/test/test_socket.py
@@ -9,6 +9,7 @@ import time
import thread, threading
import Queue
import sys
+from weakref import proxy
PORT = 50007
HOST = 'localhost'
@@ -191,6 +192,19 @@ class SocketConnectedTest(ThreadedTCPSocketTest):
class GeneralModuleTests(unittest.TestCase):
+ def test_weakref(self):
+ s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
+ p = proxy(s)
+ self.assertEqual(p.fileno(), s.fileno())
+ s.close()
+ s = None
+ try:
+ p.fileno()
+ except ReferenceError:
+ pass
+ else:
+ self.fail('Socket proxy still exists')
+
def testSocketError(self):
# Testing socket module exceptions
def raise_error(*args, **kwargs):