mirror of
https://github.com/python/cpython.git
synced 2025-08-04 08:59:19 +00:00
bpo-28254: _posixsubprocess uses PyGC_Enable/PyGC_Disable (GH-25693)
This commit is contained in:
parent
3b52c8d66b
commit
103d5e420d
2 changed files with 5 additions and 123 deletions
|
@ -2147,8 +2147,6 @@ class POSIXProcessTestCase(BaseTestCase):
|
|||
def test_preexec_gc_module_failure(self):
|
||||
# This tests the code that disables garbage collection if the child
|
||||
# process will execute any Python.
|
||||
def raise_runtime_error():
|
||||
raise RuntimeError("this shouldn't escape")
|
||||
enabled = gc.isenabled()
|
||||
orig_gc_disable = gc.disable
|
||||
orig_gc_isenabled = gc.isenabled
|
||||
|
@ -2165,16 +2163,6 @@ class POSIXProcessTestCase(BaseTestCase):
|
|||
subprocess.call([sys.executable, '-c', ''],
|
||||
preexec_fn=lambda: None)
|
||||
self.assertTrue(gc.isenabled(), "Popen left gc disabled.")
|
||||
|
||||
gc.disable = raise_runtime_error
|
||||
self.assertRaises(RuntimeError, subprocess.Popen,
|
||||
[sys.executable, '-c', ''],
|
||||
preexec_fn=lambda: None)
|
||||
|
||||
del gc.isenabled # force an AttributeError
|
||||
self.assertRaises(AttributeError, subprocess.Popen,
|
||||
[sys.executable, '-c', ''],
|
||||
preexec_fn=lambda: None)
|
||||
finally:
|
||||
gc.disable = orig_gc_disable
|
||||
gc.isenabled = orig_gc_isenabled
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue