summaryrefslogtreecommitdiffstats
path: root/Lib/multiprocessing/process.py
diff options
context:
space:
mode:
authorAntoine Pitrou <solipsis@pitrou.net>2011-07-15 20:12:24 (GMT)
committerAntoine Pitrou <solipsis@pitrou.net>2011-07-15 20:12:24 (GMT)
commitc081c0c6a0c917de72b7d7944c5316174717d56d (patch)
tree184657849382db7dec5904be11d3d44895f6a16c /Lib/multiprocessing/process.py
parentb8298a01e6fefec9b0b64fd6915e57fc246b9a55 (diff)
downloadcpython-c081c0c6a0c917de72b7d7944c5316174717d56d.zip
cpython-c081c0c6a0c917de72b7d7944c5316174717d56d.tar.gz
cpython-c081c0c6a0c917de72b7d7944c5316174717d56d.tar.bz2
Issue #12573: Add resource checks for dangling Thread and Process objects.
Diffstat (limited to 'Lib/multiprocessing/process.py')
-rw-r--r--Lib/multiprocessing/process.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/Lib/multiprocessing/process.py b/Lib/multiprocessing/process.py
index 941893f..5987af9 100644
--- a/Lib/multiprocessing/process.py
+++ b/Lib/multiprocessing/process.py
@@ -42,6 +42,7 @@ import os
import sys
import signal
import itertools
+from _weakrefset import WeakSet
#
#
@@ -105,6 +106,7 @@ class Process(object):
self._kwargs = dict(kwargs)
self._name = name or type(self).__name__ + '-' + \
':'.join(str(i) for i in self._identity)
+ _dangling.add(self)
def run(self):
'''
@@ -328,3 +330,6 @@ _exitcode_to_name = {}
for name, signum in list(signal.__dict__.items()):
if name[:3]=='SIG' and '_' not in name:
_exitcode_to_name[-signum] = name
+
+# For debug and leak testing
+_dangling = WeakSet()