pFad - Phone/Frame/Anonymizer/Declutterfier! Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

URL: http://github.com/python/cpython/pull/137118.patch

ocessing-start-methods`. - While this restriction is not true if using the ``"fork"`` start method, - as of Python ``3.14`` that is no longer the default on any platform. See - :ref:`multiprocessing-start-methods`. + .. versionchanged:: 3.3 + Added the *daemon* parameter. .. method:: run() From 4ad605aa1e3bee48da97ed134c354acd8dcf2467 Mon Sep 17 00:00:00 2001 From: "Gregory P. Smith" Date: Sun, 27 Jul 2025 19:07:37 +0000 Subject: [PATCH 4/7] move back to a note, it keeps it clear that this is "special" --- Doc/library/multiprocessing.rst | 46 +++++++++++++++++---------------- 1 file changed, 24 insertions(+), 22 deletions(-) diff --git a/Doc/library/multiprocessing.rst b/Doc/library/multiprocessing.rst index ca3e0bca76c2d0..9df60627ef763f 100644 --- a/Doc/library/multiprocessing.rst +++ b/Doc/library/multiprocessing.rst @@ -548,33 +548,35 @@ The :mod:`multiprocessing` package mostly replicates the API of the base class constructor (:meth:`Process.__init__`) before doing anything else to the process. - In general, all arguments to :meth:`Process.__init__` must be picklable. - This is particularly notable when trying to create a :class:`Process` or - use a :class:`~concurrent.futures.ProcessPoolExecutor` from a REPL with a - locally defined *target* function. + .. note:: - Passing a callable object defined in the current REPL session raises an - :exc:`AttributeError` exception when starting the process as such as - *target* must have been defined within an importable module to under to be - unpickled. + In general, all arguments to :meth:`Process.__init__` must be picklable. + This is particularly notable when trying to create a :class:`Process` or use + a :class:`concurrent.futures.ProcessPoolExecutor` from a REPL with a locally + defined *target* function. - Example:: + Passing a callable object defined in the current REPL session raises an + :exc:`AttributeError` exception when starting the process as such as + *target* must have been defined within an importable module to under to be + unpickled. - >>> import multiprocessing as mp - >>> def knigit(): - ... print("knee!") - ... - >>> mp.Process(target=knigit).start() - >>> Traceback (most recent call last): - File ".../multiprocessing/spawn.py", line ..., in spawn_main - File ".../multiprocessing/spawn.py", line ..., in _main - AttributeError: module '__main__' has no attribute 'knigit' + Example:: + + >>> import multiprocessing as mp + >>> def knigit(): + ... print("knee!") + ... + >>> mp.Process(target=knigit).start() + >>> Traceback (most recent call last): + File ".../multiprocessing/spawn.py", line ..., in spawn_main + File ".../multiprocessing/spawn.py", line ..., in _main + AttributeError: module '__main__' has no attribute 'knigit' - See :ref:`multiprocessing-programming-spawn`. + See :ref:`multiprocessing-programming-spawn`. - While this restriction is not true if using the ``"fork"`` start method, - as of Python ``3.14`` that is no longer the default on any platform. See - :ref:`multiprocessing-start-methods`. + While this restriction is not true if using the ``"fork"`` start method, + as of Python ``3.14`` that is no longer the default on any platform. See + :ref:`multiprocessing-start-methods`. .. versionchanged:: 3.3 Added the *daemon* parameter. From 2a115a31475647b01b04d401bc2cb9d48883d9be Mon Sep 17 00:00:00 2001 From: "Gregory P. Smith" Date: Sun, 27 Jul 2025 19:23:34 +0000 Subject: [PATCH 5/7] editing for clarity --- Doc/library/multiprocessing.rst | 36 +++++++++++++++++---------------- 1 file changed, 19 insertions(+), 17 deletions(-) diff --git a/Doc/library/multiprocessing.rst b/Doc/library/multiprocessing.rst index 9df60627ef763f..3f940782382c83 100644 --- a/Doc/library/multiprocessing.rst +++ b/Doc/library/multiprocessing.rst @@ -545,37 +545,39 @@ The :mod:`multiprocessing` package mostly replicates the API of the to pass to *target*. If a subclass overrides the constructor, it must make sure it invokes the - base class constructor (:meth:`Process.__init__`) before doing anything else + base class constructor (``super().__init__()``) before doing anything else to the process. .. note:: - In general, all arguments to :meth:`Process.__init__` must be picklable. - This is particularly notable when trying to create a :class:`Process` or use - a :class:`concurrent.futures.ProcessPoolExecutor` from a REPL with a locally - defined *target* function. + In general, all arguments to :class:`Process` must be picklable. This is + frequently observed when trying to create a :class:`Process` or use a + :class:`concurrent.futures.ProcessPoolExecutor` from a REPL with a + locally defined *target* function. - Passing a callable object defined in the current REPL session raises an - :exc:`AttributeError` exception when starting the process as such as - *target* must have been defined within an importable module to under to be - unpickled. + Passing a callable object defined in the current REPL session causes the + child process to die via an uncaught :exc:`AttributeError` exception when + starting as *target* must have been defined within an importable module + in order to be loaded during unpickling. - Example:: + Example of this uncatchable error from the child:: >>> import multiprocessing as mp >>> def knigit(): - ... print("knee!") + ... print("Ni!") ... - >>> mp.Process(target=knigit).start() + >>> process = mp.Process(target=knigit) + >>> process.start() >>> Traceback (most recent call last): File ".../multiprocessing/spawn.py", line ..., in spawn_main File ".../multiprocessing/spawn.py", line ..., in _main AttributeError: module '__main__' has no attribute 'knigit' + >>> process + - See :ref:`multiprocessing-programming-spawn`. - - While this restriction is not true if using the ``"fork"`` start method, - as of Python ``3.14`` that is no longer the default on any platform. See + See :ref:`multiprocessing-programming-spawn`. While this restriction is + not true if using the ``"fork"`` start method, as of Python ``3.14`` that + is no longer the default on any platform. See :ref:`multiprocessing-start-methods`. .. versionchanged:: 3.3 @@ -3107,7 +3109,7 @@ start method. More picklability - Ensure that all arguments to :meth:`Process.__init__` are picklable. + Ensure that all arguments to :class:`Process` are picklable. Also, if you subclass :class:`~multiprocessing.Process` then make sure that instances will be picklable when the :meth:`Process.start ` method is called. From 5f36fbff8c5c0f524ec2d799bc40c191cf1b7bd6 Mon Sep 17 00:00:00 2001 From: "Gregory P. Smith" Date: Sun, 27 Jul 2025 19:30:54 +0000 Subject: [PATCH 6/7] formatting --- Doc/library/multiprocessing.rst | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Doc/library/multiprocessing.rst b/Doc/library/multiprocessing.rst index 3f940782382c83..dd6591043fbb23 100644 --- a/Doc/library/multiprocessing.rst +++ b/Doc/library/multiprocessing.rst @@ -3109,10 +3109,10 @@ start method. More picklability - Ensure that all arguments to :class:`Process` are picklable. - Also, if you subclass :class:`~multiprocessing.Process` then make sure that - instances will be picklable when the :meth:`Process.start - ` method is called. + Ensure that all arguments to :class:`~multiprocessing.Process` are + picklable. Also, if you subclass ``Process.__init__``, you must make sure + that instances will be picklable when the + :meth:`Process.start ` method is called. Global variables From 4b848a9ff95806c55fcb3ea52c4119795f802bbd Mon Sep 17 00:00:00 2001 From: "Gregory P. Smith" Date: Sun, 27 Jul 2025 19:39:53 +0000 Subject: [PATCH 7/7] add a pointer to the GH issue from the doc note --- Doc/library/multiprocessing.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/Doc/library/multiprocessing.rst b/Doc/library/multiprocessing.rst index dd6591043fbb23..d18ada3511d891 100644 --- a/Doc/library/multiprocessing.rst +++ b/Doc/library/multiprocessing.rst @@ -579,6 +579,7 @@ The :mod:`multiprocessing` package mostly replicates the API of the not true if using the ``"fork"`` start method, as of Python ``3.14`` that is no longer the default on any platform. See :ref:`multiprocessing-start-methods`. + See also :gh:`132898`. .. versionchanged:: 3.3 Added the *daemon* parameter. pFad - Phonifier reborn

Pfad - The Proxy pFad © 2024 Your Company Name. All rights reserved.





Check this box to remove all script contents from the fetched content.



Check this box to remove all images from the fetched content.


Check this box to remove all CSS styles from the fetched content.


Check this box to keep images inefficiently compressed and original size.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy