mirror of
https://github.com/python/cpython.git
synced 2025-10-06 07:02:33 +00:00
[3.6] Clear potential ref cycle between Process and Process target (GH-2470) (#2471)
* Clear potential ref cycle between Process and Process target
Besides Process.join() not being called, this was an indirect cause of bpo-30775.
The threading module already does this.
* Add issue reference.
(cherry picked from commit 79d37ae979
)
This commit is contained in:
parent
e022aad73a
commit
38d6a40898
2 changed files with 21 additions and 0 deletions
|
@ -104,6 +104,9 @@ class BaseProcess(object):
|
|||
_cleanup()
|
||||
self._popen = self._Popen(self)
|
||||
self._sentinel = self._popen.sentinel
|
||||
# Avoid a refcycle if the target function holds an indirect
|
||||
# reference to the process object (see bpo-30775)
|
||||
del self._target, self._args, self._kwargs
|
||||
_children.add(self)
|
||||
|
||||
def terminate(self):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue