summaryrefslogtreecommitdiff
path: root/Lib/threading.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/threading.py')
-rw-r--r--Lib/threading.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/Lib/threading.py b/Lib/threading.py
index 409360dae2..2f472b47aa 100644
--- a/Lib/threading.py
+++ b/Lib/threading.py
@@ -444,6 +444,9 @@ class Thread(_Verbose):
def run(self):
if self.__target:
self.__target(*self.__args, **self.__kwargs)
+ # Avoid a refcycle if the thread is running a function with an
+ # argument that has a member that points to the thread.
+ del self.__target, self.__args, self.__kwargs
def __bootstrap(self):
# Wrapper around the real bootstrap code that ignores