]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-129158: Ensure we restore unix_events.can_use_pidfd after SubprocessThreadedWatche...
authorPablo Galindo Salgado <Pablogsal@gmail.com>
Wed, 22 Jan 2025 12:25:42 +0000 (12:25 +0000)
committerGitHub <noreply@github.com>
Wed, 22 Jan 2025 12:25:42 +0000 (12:25 +0000)
Lib/test/test_asyncio/test_subprocess.py

index 57decaf2d277fb02482bfece7de171ee3d21e89b..a053db8e6d76f206f29e7c0396fc343211c5b95e 100644 (file)
@@ -901,9 +901,14 @@ if sys.platform != 'win32':
     class SubprocessThreadedWatcherTests(SubprocessWatcherMixin,
                                          test_utils.TestCase):
         def setUp(self):
+            self._original_can_use_pidfd = unix_events.can_use_pidfd
             # Force the use of the threaded child watcher
             unix_events.can_use_pidfd = mock.Mock(return_value=False)
             super().setUp()
+        
+        def tearDown(self):
+            unix_events.can_use_pidfd = self._original_can_use_pidfd
+            return super().tearDown()
 
     @unittest.skipUnless(
         unix_events.can_use_pidfd(),