Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit b674dcf

Browse files
committed
Some fixes for the documentation of multiprocessing (per issue #13686)
1 parent e08824c commit b674dcf

1 file changed

Lines changed: 32 additions & 24 deletions

File tree

Doc/library/multiprocessing.rst

Lines changed: 32 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -305,14 +305,12 @@ The :mod:`multiprocessing` package mostly replicates the API of the
305305
should always be ``None``; it exists solely for compatibility with
306306
:class:`threading.Thread`. *target* is the callable object to be invoked by
307307
the :meth:`run()` method. It defaults to ``None``, meaning nothing is
308-
called. *name* is the process name. By default, a unique name is constructed
309-
of the form 'Process-N\ :sub:`1`:N\ :sub:`2`:...:N\ :sub:`k`' where N\
310-
:sub:`1`,N\ :sub:`2`,...,N\ :sub:`k` is a sequence of integers whose length
311-
is determined by the *generation* of the process. *args* is the argument
312-
tuple for the target invocation. *kwargs* is a dictionary of keyword
313-
arguments for the target invocation. If provided, the keyword-only *daemon* argument
314-
sets the process :attr:`daemon` flag to ``True`` or ``False``. If ``None``
315-
(the default), this flag will be inherited from the creating process.
308+
called. *name* is the process name (see :attr:`name` for more details).
309+
*args* is the argument tuple for the target invocation. *kwargs* is a
310+
dictionary of keyword arguments for the target invocation. If provided,
311+
the keyword-only *daemon* argument sets the process :attr:`daemon` flag
312+
to ``True`` or ``False``. If ``None`` (the default), this flag will be
313+
inherited from the creating process.
316314

317315
By default, no arguments are passed to *target*.
318316

@@ -352,11 +350,14 @@ The :mod:`multiprocessing` package mostly replicates the API of the
352350

353351
.. attribute:: name
354352

355-
The process's name.
353+
The process's name. The name is a string used for identification purposes
354+
only. It has no semantics. Multiple processes may be given the same
355+
name.
356356

357-
The name is a string used for identification purposes only. It has no
358-
semantics. Multiple processes may be given the same name. The initial
359-
name is set by the constructor.
357+
The initial name is set by the constructor. If no explicit name is
358+
provided to the constructor, a name of the form
359+
'Process-N\ :sub:`1`:N\ :sub:`2`:...:N\ :sub:`k`' is constructed, where
360+
each N\ :sub:`k` is the N-th child of its parent.
360361

361362
.. method:: is_alive
362363

@@ -462,6 +463,9 @@ The :mod:`multiprocessing` package mostly replicates the API of the
462463
>>> p.exitcode == -signal.SIGTERM
463464
True
464465

466+
.. exception:: ProcessError
467+
468+
The base class of all :mod:`multiprocessing` exceptions.
465469

466470
.. exception:: BufferTooShort
467471

@@ -471,6 +475,13 @@ The :mod:`multiprocessing` package mostly replicates the API of the
471475
If ``e`` is an instance of :exc:`BufferTooShort` then ``e.args[0]`` will give
472476
the message as a byte string.
473477

478+
.. exception:: AuthenticationError
479+
480+
Raised when there is an authentication error.
481+
482+
.. exception:: TimeoutError
483+
484+
Raised by methods with a timeout when the timeout expires.
474485

475486
Pipes and Queues
476487
~~~~~~~~~~~~~~~~
@@ -1838,15 +1849,15 @@ multiple connections at the same time.
18381849

18391850
If the reply matches the digest of the message using *authkey* as the key
18401851
then a welcome message is sent to the other end of the connection. Otherwise
1841-
:exc:`AuthenticationError` is raised.
1852+
:exc:`~multiprocessing.AuthenticationError` is raised.
18421853

18431854
.. function:: answerChallenge(connection, authkey)
18441855

18451856
Receive a message, calculate the digest of the message using *authkey* as the
18461857
key, and then send the digest back.
18471858

1848-
If a welcome message is not received, then :exc:`AuthenticationError` is
1849-
raised.
1859+
If a welcome message is not received, then
1860+
:exc:`~multiprocessing.AuthenticationError` is raised.
18501861

18511862
.. function:: Client(address[, family[, authenticate[, authkey]]])
18521863

@@ -1860,7 +1871,8 @@ multiple connections at the same time.
18601871
If *authenticate* is ``True`` or *authkey* is a string then digest
18611872
authentication is used. The key used for authentication will be either
18621873
*authkey* or ``current_process().authkey)`` if *authkey* is ``None``.
1863-
If authentication fails then :exc:`AuthenticationError` is raised. See
1874+
If authentication fails then
1875+
:exc:`~multiprocessing.AuthenticationError` is raised. See
18641876
:ref:`multiprocessing-auth-keys`.
18651877

18661878
.. class:: Listener([address[, family[, backlog[, authenticate[, authkey]]]]])
@@ -1901,13 +1913,15 @@ multiple connections at the same time.
19011913
``current_process().authkey`` is used as the authentication key. If
19021914
*authkey* is ``None`` and *authenticate* is ``False`` then no
19031915
authentication is done. If authentication fails then
1904-
:exc:`AuthenticationError` is raised. See :ref:`multiprocessing-auth-keys`.
1916+
:exc:`~multiprocessing.AuthenticationError` is raised.
1917+
See :ref:`multiprocessing-auth-keys`.
19051918

19061919
.. method:: accept()
19071920

19081921
Accept a connection on the bound socket or named pipe of the listener
19091922
object and return a :class:`Connection` object. If authentication is
1910-
attempted and fails, then :exc:`AuthenticationError` is raised.
1923+
attempted and fails, then
1924+
:exc:`~multiprocessing.AuthenticationError` is raised.
19111925

19121926
.. method:: close()
19131927

@@ -1965,12 +1979,6 @@ multiple connections at the same time.
19651979

19661980
.. versionadded:: 3.3
19671981

1968-
The module defines two exceptions:
1969-
1970-
.. exception:: AuthenticationError
1971-
1972-
Exception raised when there is an authentication error.
1973-
19741982

19751983
**Examples**
19761984

0 commit comments

Comments
 (0)