mirror of
https://github.com/python/cpython.git
synced 2025-08-04 17:08:35 +00:00
Issue #12573: Add resource checks for dangling Thread and Process objects.
This commit is contained in:
parent
b8298a01e6
commit
c081c0c6a0
4 changed files with 47 additions and 1 deletions
|
@ -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()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue