summaryrefslogtreecommitdiffstats
path: root/Lib/test
diff options
context:
space:
mode:
authortzickel <tzickel@users.noreply.github.com>2018-10-02 21:01:23 (GMT)
committerAntoine Pitrou <pitrou@free.fr>2018-10-02 21:01:23 (GMT)
commit97bfe8d3ebb0a54c8798f57555cb4152f9b2e1d0 (patch)
treeb97ded93b7eece4244ce9719f75469f3410083f2 /Lib/test
parent9012a0fb4c4ec1afef9efb9fdb0964554ea17983 (diff)
downloadcpython-97bfe8d3ebb0a54c8798f57555cb4152f9b2e1d0.zip
cpython-97bfe8d3ebb0a54c8798f57555cb4152f9b2e1d0.tar.gz
cpython-97bfe8d3ebb0a54c8798f57555cb4152f9b2e1d0.tar.bz2
bpo-34172: multiprocessing.Pool leaks resources after being deleted (GH-8450)
Fix a reference issue inside multiprocessing.Pool that caused the pool to remain alive if it was deleted without being closed or terminated explicitly.
Diffstat (limited to 'Lib/test')
-rw-r--r--Lib/test/_test_multiprocessing.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/Lib/test/_test_multiprocessing.py b/Lib/test/_test_multiprocessing.py
index d728091..71f40a0 100644
--- a/Lib/test/_test_multiprocessing.py
+++ b/Lib/test/_test_multiprocessing.py
@@ -2549,6 +2549,12 @@ class _TestPool(BaseTestCase):
# they were released too.
self.assertEqual(CountedObject.n_instances, 0)
+ def test_del_pool(self):
+ p = self.Pool(1)
+ wr = weakref.ref(p)
+ del p
+ gc.collect()
+ self.assertIsNone(wr())
def raising():
raise KeyError("key")