diff options
author | Victor Stinner <vstinner@redhat.com> | 2018-12-14 11:58:52 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-12-14 11:58:52 (GMT) |
commit | 7acd50ad8b2a4fe132f7b26980ed3cd209b7ea12 (patch) | |
tree | 2a08755864f9da7648ba66f58ecebd081f966f98 /Doc | |
parent | cb0f5e29e37c081e9bba91a9858370e2504e9e8e (diff) | |
download | cpython-7acd50ad8b2a4fe132f7b26980ed3cd209b7ea12.zip cpython-7acd50ad8b2a4fe132f7b26980ed3cd209b7ea12.tar.gz cpython-7acd50ad8b2a4fe132f7b26980ed3cd209b7ea12.tar.bz2 |
bpo-35491: Enhance multiprocessing.BaseProcess.__repr__() (GH-11138)
* Add the pid and parent pid to multiprocessing.BaseProcess.__repr__().
* Add negative sign (ex: "-SIGTERM") to exitcode (process killed
by a signal)
* Only call _popen.poll() once.
Example:
<ForkProcess(ForkPoolWorker-1, started daemon)>
becomes:
<ForkProcess name='ForkPoolWorker-1' pid=12449 parent=12448 started daemon>
Example:
<ForkProcess(ForkPoolWorker-1, stopped[SIGTERM] daemon)>
becomes:
<ForkProcess name='ForkPoolWorker-1' pid=12960 parent=12959 stopped exitcode=-SIGTERM daemon>
Diffstat (limited to 'Doc')
-rw-r--r-- | Doc/library/multiprocessing.rst | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/Doc/library/multiprocessing.rst b/Doc/library/multiprocessing.rst index 578b548..1d0920a 100644 --- a/Doc/library/multiprocessing.rst +++ b/Doc/library/multiprocessing.rst @@ -626,14 +626,14 @@ The :mod:`multiprocessing` package mostly replicates the API of the >>> import multiprocessing, time, signal >>> p = multiprocessing.Process(target=time.sleep, args=(1000,)) >>> print(p, p.is_alive()) - <Process(..., initial)> False + <Process ... initial> False >>> p.start() >>> print(p, p.is_alive()) - <Process(..., started)> True + <Process ... started> True >>> p.terminate() >>> time.sleep(0.1) >>> print(p, p.is_alive()) - <Process(..., stopped[SIGTERM])> False + <Process ... stopped exitcode=-SIGTERM> False >>> p.exitcode == -signal.SIGTERM True |