summaryrefslogtreecommitdiffstats
path: root/Lib/multiprocessing/process.py
diff options
context:
space:
mode:
authorAntoine Pitrou <solipsis@pitrou.net>2011-07-15 20:15:38 (GMT)
committerAntoine Pitrou <solipsis@pitrou.net>2011-07-15 20:15:38 (GMT)
commit428bc6c48f41123149ddf1c3589fbe548cc38c48 (patch)
tree80f470fa46e60653994c790718621b2dfb56c580 /Lib/multiprocessing/process.py
parent91fe8157fd3518fcf7c2f7cd7bd247131e8e839f (diff)
parentc081c0c6a0c917de72b7d7944c5316174717d56d (diff)
downloadcpython-428bc6c48f41123149ddf1c3589fbe548cc38c48.zip
cpython-428bc6c48f41123149ddf1c3589fbe548cc38c48.tar.gz
cpython-428bc6c48f41123149ddf1c3589fbe548cc38c48.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 86c291e..98ce0da 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
#
#
@@ -109,6 +110,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):
'''
@@ -344,3 +346,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()