@@ -4734,8 +4734,13 @@ def non_linux_skip_if_other_okay_error(self, err):
4734
4734
# we're specifically trying to test. The way this test is written
4735
4735
# is known to work on Linux. We'll skip it anywhere else that it
4736
4736
# does not present as doing so.
4737
- self .skipTest (f"Could not recreate conditions on { sys .platform } :"
4738
- f" { err = } " )
4737
+ try :
4738
+ self .skipTest (f"Could not recreate conditions on { sys .platform } :"
4739
+ f" { err = } " )
4740
+ finally :
4741
+ # gh-108342: Explicitly break the reference cycle
4742
+ err = None
4743
+
4739
4744
# If maintaining this conditional winds up being a problem.
4740
4745
# just turn this into an unconditional skip anything but Linux.
4741
4746
# The important thing is that our CI has the logic covered.
@@ -4767,15 +4772,22 @@ def call_after_accept(unused):
4767
4772
4768
4773
ready_for_server_wrap_socket .set ()
4769
4774
server .join ()
4775
+
4770
4776
wrap_error = server .wrap_error
4771
- self .assertEqual (b"" , server .received_data )
4772
- self .assertIsInstance (wrap_error , OSError ) # All platforms.
4773
- self .non_linux_skip_if_other_okay_error (wrap_error )
4774
- self .assertIsInstance (wrap_error , ssl .SSLError )
4775
- self .assertIn ("before TLS handshake with data" , wrap_error .args [1 ])
4776
- self .assertIn ("before TLS handshake with data" , wrap_error .reason )
4777
- self .assertNotEqual (0 , wrap_error .args [0 ])
4778
- self .assertIsNone (wrap_error .library , msg = "attr must exist" )
4777
+ server .wrap_error = None
4778
+ try :
4779
+ self .assertEqual (b"" , server .received_data )
4780
+ self .assertIsInstance (wrap_error , OSError ) # All platforms.
4781
+ self .non_linux_skip_if_other_okay_error (wrap_error )
4782
+ self .assertIsInstance (wrap_error , ssl .SSLError )
4783
+ self .assertIn ("before TLS handshake with data" , wrap_error .args [1 ])
4784
+ self .assertIn ("before TLS handshake with data" , wrap_error .reason )
4785
+ self .assertNotEqual (0 , wrap_error .args [0 ])
4786
+ self .assertIsNone (wrap_error .library , msg = "attr must exist" )
4787
+ finally :
4788
+ # gh-108342: Explicitly break the reference cycle
4789
+ wrap_error = None
4790
+ server = None
4779
4791
4780
4792
def test_preauth_data_to_tls_client (self ):
4781
4793
client_can_continue_with_wrap_socket = threading .Event ()
@@ -4815,14 +4827,19 @@ def call_after_accept(conn_to_client):
4815
4827
tls_client .close ()
4816
4828
4817
4829
server .join ()
4818
- self .assertEqual (b"" , received_data )
4819
- self .assertIsInstance (wrap_error , OSError ) # All platforms.
4820
- self .non_linux_skip_if_other_okay_error (wrap_error )
4821
- self .assertIsInstance (wrap_error , ssl .SSLError )
4822
- self .assertIn ("before TLS handshake with data" , wrap_error .args [1 ])
4823
- self .assertIn ("before TLS handshake with data" , wrap_error .reason )
4824
- self .assertNotEqual (0 , wrap_error .args [0 ])
4825
- self .assertIsNone (wrap_error .library , msg = "attr must exist" )
4830
+ try :
4831
+ self .assertEqual (b"" , received_data )
4832
+ self .assertIsInstance (wrap_error , OSError ) # All platforms.
4833
+ self .non_linux_skip_if_other_okay_error (wrap_error )
4834
+ self .assertIsInstance (wrap_error , ssl .SSLError )
4835
+ self .assertIn ("before TLS handshake with data" , wrap_error .args [1 ])
4836
+ self .assertIn ("before TLS handshake with data" , wrap_error .reason )
4837
+ self .assertNotEqual (0 , wrap_error .args [0 ])
4838
+ self .assertIsNone (wrap_error .library , msg = "attr must exist" )
4839
+ finally :
4840
+ # gh-108342: Explicitly break the reference cycle
4841
+ wrap_error = None
4842
+ server = None
4826
4843
4827
4844
def test_https_client_non_tls_response_ignored (self ):
4828
4845
0 commit comments