bpo-41833: threading.Thread now uses the target name (GH-22357)

This commit is contained in:
Victor Stinner 2020-09-23 23:21:19 +02:00 committed by GitHub
parent 2e4dd336e5
commit 98c16c991d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 55 additions and 10 deletions

View file

@ -264,8 +264,10 @@ since it is impossible to detect the termination of alien threads.
*target* is the callable object to be invoked by the :meth:`run` method.
Defaults to ``None``, meaning nothing is called.
*name* is the thread name. By default, a unique name is constructed of the
form "Thread-*N*" where *N* is a small decimal number.
*name* is the thread name. By default, a unique name is constructed
of the form "Thread-*N*" where *N* is a small decimal number,
or "Thread-*N* (target)" where "target" is ``target.__name__`` if the
*target* argument is specified.
*args* is the argument tuple for the target invocation. Defaults to ``()``.
@ -280,6 +282,9 @@ since it is impossible to detect the termination of alien threads.
base class constructor (``Thread.__init__()``) before doing anything else to
the thread.
.. versionchanged:: 3.10
Use the *target* name if *name* argument is omitted.
.. versionchanged:: 3.3
Added the *daemon* argument.