]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-117649: Fix file descriptor leak in (expected) failing test case (#117780)
authorSam Gross <colesbury@gmail.com>
Thu, 11 Apr 2024 21:35:46 +0000 (17:35 -0400)
committerGitHub <noreply@github.com>
Thu, 11 Apr 2024 21:35:46 +0000 (21:35 +0000)
The test case is currently expected to fail in the free-threaded build.
However, it fails before it gets a chance to close the write end of
the pipe.

Lib/test/test_capi/test_misc.py

index 8cdecaf3626401e6e7adcb3f28c9133851cb14c6..9c24ec8fd05b12e7287c844d4454d65b42dc1ce0 100644 (file)
@@ -2139,6 +2139,9 @@ class SubinterpreterTest(unittest.TestCase):
             }
 
             r, w = os.pipe()
+            if Py_GIL_DISABLED:
+                # gh-117649: The test fails before `w` is closed
+                self.addCleanup(os.close, w)
             script = textwrap.dedent(f'''
                 from test.test_capi.check_config import run_singlephase_check
                 run_singlephase_check({override}, {w})