Issue #12573: Add resource checks for dangling Thread and Process objects.

This commit is contained in:
Antoine Pitrou 2011-07-15 22:12:24 +02:00
parent b8298a01e6
commit c081c0c6a0
4 changed files with 47 additions and 1 deletions

View file

@ -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()