[Python-checkins] bpo-28254: Cleanup test_subprocess.test_preexec_gc_module_failure() (GH-25709)

vstinner webhook-mailer at python.org
Thu Apr 29 04:26:57 EDT 2021


https://github.com/python/cpython/commit/b1f413e6cf63a1c5704fcb47f2095ef5db8970bb
commit: b1f413e6cf63a1c5704fcb47f2095ef5db8970bb
branch: master
author: Victor Stinner <vstinner at python.org>
committer: vstinner <vstinner at python.org>
date: 2021-04-29T10:26:53+02:00
summary:

bpo-28254: Cleanup test_subprocess.test_preexec_gc_module_failure() (GH-25709)

Saving/restoring gc.disable and gc.isenabled is no longer needed.

files:
M Lib/test/test_subprocess.py

diff --git a/Lib/test/test_subprocess.py b/Lib/test/test_subprocess.py
index 27ccd3e5cb3a8..f0f0e6f6069da 100644
--- a/Lib/test/test_subprocess.py
+++ b/Lib/test/test_subprocess.py
@@ -2148,8 +2148,6 @@ def test_preexec_gc_module_failure(self):
         # 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 @@ def test_preexec_gc_module_failure(self):
                             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()
 



More information about the Python-checkins mailing list