This constructor should always be called with keyword arguments. Arguments are: *group* should be None; reserved for future extension when a ThreadGroup class is implemented. *target* is the callable object to be invoked by the run() method. Defaults to None,
(self, group=None, target=None, name=None,
args=(), kwargs=None, *, daemon=None)
| 854 | _initialized = False |
| 855 | |
| 856 | def __init__(self, group=None, target=None, name=None, |
| 857 | args=(), kwargs=None, *, daemon=None): |
| 858 | """This constructor should always be called with keyword arguments. Arguments are: |
| 859 | |
| 860 | *group* should be None; reserved for future extension when a ThreadGroup |
| 861 | class is implemented. |
| 862 | |
| 863 | *target* is the callable object to be invoked by the run() |
| 864 | method. Defaults to None, meaning nothing is called. |
| 865 | |
| 866 | *name* is the thread name. By default, a unique name is constructed of |
| 867 | the form "Thread-N" where N is a small decimal number. |
| 868 | |
| 869 | *args* is a list or tuple of arguments for the target invocation. Defaults to (). |
| 870 | |
| 871 | *kwargs* is a dictionary of keyword arguments for the target |
| 872 | invocation. Defaults to {}. |
| 873 | |
| 874 | If a subclass overrides the constructor, it must make sure to invoke |
| 875 | the base class constructor (Thread.__init__()) before doing anything |
| 876 | else to the thread. |
| 877 | |
| 878 | """ |
| 879 | assert group is None, "group argument must be None for now" |
| 880 | if kwargs is None: |
| 881 | kwargs = {} |
| 882 | if name: |
| 883 | name = str(name) |
| 884 | else: |
| 885 | name = _newname("Thread-%d") |
| 886 | if target is not None: |
| 887 | try: |
| 888 | target_name = target.__name__ |
| 889 | name += f" ({target_name})" |
| 890 | except AttributeError: |
| 891 | pass |
| 892 | |
| 893 | self._target = target |
| 894 | self._name = name |
| 895 | self._args = args |
| 896 | self._kwargs = kwargs |
| 897 | if daemon is not None: |
| 898 | self._daemonic = daemon |
| 899 | else: |
| 900 | self._daemonic = current_thread().daemon |
| 901 | self._ident = None |
| 902 | if _HAVE_THREAD_NATIVE_ID: |
| 903 | self._native_id = None |
| 904 | self._tstate_lock = None |
| 905 | self._started = Event() |
| 906 | self._is_stopped = False |
| 907 | self._initialized = True |
| 908 | # Copy of sys.stderr used by self._invoke_excepthook() |
| 909 | self._stderr = _sys.stderr |
| 910 | self._invoke_excepthook = _make_invoke_excepthook() |
| 911 | # For debugging and _after_fork() |
| 912 | _dangling.add(self) |
| 913 |
nothing calls this directly
no test coverage detected