]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
bpo-28254: Cleanup test_subprocess.test_preexec_gc_module_failure() (GH-25709)
authorVictor Stinner <vstinner@python.org>
Thu, 29 Apr 2021 08:26:53 +0000 (10:26 +0200)
committerGitHub <noreply@github.com>
Thu, 29 Apr 2021 08:26:53 +0000 (10:26 +0200)
Saving/restoring gc.disable and gc.isenabled is no longer needed.

Lib/test/test_subprocess.py

index 27ccd3e5cb3a895eb67ed72093e582bc1b786385..f0f0e6f6069da7f9ac2f8bb4f2dffda758d9f938 100644 (file)
@@ -2148,8 +2148,6 @@ class POSIXProcessTestCase(BaseTestCase):
         # This tests the code that disables garbage collection if the child
         # process will execute any Python.
         enabled = gc.isenabled()
-        orig_gc_disable = gc.disable
-        orig_gc_isenabled = gc.isenabled
         try:
             gc.disable()
             self.assertFalse(gc.isenabled())
@@ -2164,8 +2162,6 @@ class POSIXProcessTestCase(BaseTestCase):
                             preexec_fn=lambda: None)
             self.assertTrue(gc.isenabled(), "Popen left gc disabled.")
         finally:
-            gc.disable = orig_gc_disable
-            gc.isenabled = orig_gc_isenabled
             if not enabled:
                 gc.disable()