]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Only the test is merged in.
authorAntoine Pitrou <solipsis@pitrou.net>
Fri, 23 Apr 2010 23:10:32 +0000 (23:10 +0000)
committerAntoine Pitrou <solipsis@pitrou.net>
Fri, 23 Apr 2010 23:10:32 +0000 (23:10 +0000)
Merged revisions 80423 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r80423 | antoine.pitrou | 2010-04-24 00:54:59 +0200 (sam., 24 avril 2010) | 4 lines

  Issue #7943: Fix circular reference created when instantiating an SSL
  socket.  Initial patch by Péter Szabó.
........

Lib/test/test_ssl.py

index 2aa265ae307157a3e4febf51831c2d18c8d22152..f00478cf412d278f9984e7d14c552b9259cd0d15 100644 (file)
@@ -11,6 +11,7 @@ import pprint
 import urllib.parse, urllib.request
 import traceback
 import asyncore
+import weakref
 
 from http.server import HTTPServer, SimpleHTTPRequestHandler
 
@@ -138,6 +139,16 @@ class BasicTests(unittest.TestCase):
         with self.assertRaisesRegexp(ssl.SSLError, "No cipher can be selected"):
             s.connect(remote)
 
+    @support.cpython_only
+    def test_refcycle(self):
+        # Issue #7943: an SSL object doesn't create reference cycles with
+        # itself.
+        s = socket.socket(socket.AF_INET)
+        ss = ssl.wrap_socket(s)
+        wr = weakref.ref(ss)
+        del ss
+        self.assertEqual(wr(), None)
+
 
 class NetworkedTests(unittest.TestCase):