Issue #12573: Add resource checks for dangling Thread and Process objects.
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 sys
 import signal
 import itertools
+from _weakrefset import WeakSet
 
 #
 #
@@ -105,6 +106,7 @@
         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 @@
 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()