-
-
Notifications
You must be signed in to change notification settings - Fork 32.1k
bpo-42363: enhance _check_running() ValueError output in Pool class #23299
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Hello, and thanks for your contribution! I'm a bot set up to make sure that the project can legally accept this contribution by verifying everyone involved has signed the PSF contributor agreement (CLA). CLA MissingOur records indicate the following people have not signed the CLA: For legal reasons we need all the people listed to sign the CLA before we can look at your contribution. Please follow the steps outlined in the CPython devguide to rectify this issue. If you have recently signed the CLA, please wait at least one business day You can check yourself to see if the CLA has been received. Thanks again for the contribution, we look forward to reviewing it! |
This PR is stale because it has been open for 30 days with no activity. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tests pass ok.
However the output could be better:
File "/home/me/Documents/cpython/Lib/multiprocessing/pool.py", line 350, in _check_running
raise ValueError("Pool not running because self._state is {}".format(self._state))
ValueError: Pool not running because self._state is CLOSE
Please change above line to read:
ValueError: Pool not running because the state is CLOSE
Lib/multiprocessing/pool.py
Outdated
@@ -347,7 +347,7 @@ def _setup_queues(self): | |||
|
|||
def _check_running(self): | |||
if self._state != RUN: | |||
raise ValueError("Pool not running") | |||
raise ValueError("Pool not running because self._state is {}".format(self._state)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
raise ValueError("Pool not running because self._state is {}".format(self._state)) | |
raise ValueError(f"Pool not running, state is {self._state}") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will do
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done! Pls check it out
Signed-off-by: Jim Lin <b04705003@ntu.edu.tw>
Most changes to Python require a NEWS entry. Please add it using the blurb_it web app or the blurb command-line tool. |
I just added it. Never use that before so please check that for me. |
@@ -0,0 +1 @@ | |||
enhance _check_running() ValuError error message |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add state the _check_running()
error message.
enhance _check_running() ValuError error message | |
Add state to the error message of the :meth:`multiprocessing.Pool._check_running` method in the :mod:`multiprocessing` module. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The NEWS entry doesn't mention the module name (multiprocessing) and should not reference a private function (users don't see it). Honestly, I think that you should just remove the NEWS entry. Enhancing an error message is nice, but doesn't require to be documented in the Changelog.
The current
ValueError
does not give any information aboutself._state
.So I think it will be good to output:
self._state
for the ease of debugging.https://bugs.python.org/issue42363