From 9473ae9b5105f1aeba158f2abcc0eff18a48a5c5 Mon Sep 17 00:00:00 2001 From: "Miss Islington (bot)" <31488909+miss-islington@users.noreply.github.com> Date: Sun, 10 Nov 2024 16:41:42 +0100 Subject: [PATCH] [3.13] Skip test in test_socket.py if `sys.getrefcount` isn't available (GH-126640) (#126645) Skip test in test_socket.py if `sys.getrefcount` isn't available (GH-126640) Skip `testMakefileCloseSocketDestroy` test if `sys.getrefcount` isn't available. This is necessary for PyPy and other Python implementations that do not have `sys.getrefcount`. (cherry picked from commit 0f6bb28ff3ba152faf7523ea9aaf0094cc39bdda) Co-authored-by: CF Bolz-Tereick --- Lib/test/test_socket.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Lib/test/test_socket.py b/Lib/test/test_socket.py index 4b831d666e2d..e351ccdf057e 100644 --- a/Lib/test/test_socket.py +++ b/Lib/test/test_socket.py @@ -5328,6 +5328,8 @@ class UnbufferedFileObjectClassTestCase(FileObjectClassTestCase): self.write_file.write(self.write_msg) self.write_file.flush() + @unittest.skipUnless(hasattr(sys, 'getrefcount'), + 'test needs sys.getrefcount()') def testMakefileCloseSocketDestroy(self): refcount_before = sys.getrefcount(self.cli_conn) self.read_file.close() -- 2.47.3