-
-
Notifications
You must be signed in to change notification settings - Fork 32k
gh-133089: Use original timeout value for TimeoutExpired
when the func subprocess.run
is called with a timeout
#133103
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
Conversation
…ut=None' when the timeout is zero Signed-off-by: Manjusaka <[email protected]>
Signed-off-by: Manjusaka <[email protected]>
Signed-off-by: Manjusaka <[email protected]>
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.
What about a negative timeout? Why does wait
need this too?
This needs doc updates, and a test.
Misc/NEWS.d/next/Library/2025-04-29-02-23-04.gh-issue-133089.8Jy1ZS.rst
Outdated
Show resolved
Hide resolved
How about raise ValueError when timeout is |
Hmm, looking at bash functions I get conflicting results. Yes, a value error is the way to go for negative timeouts. |
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.
I don't think timeout=0
should be treated the same as timeout=None
. This isn't done anywhere else in the standard library. For example, using asyncio
as precedent:
import asyncio
async def main():
async with asyncio.timeout(None):
await asyncio.sleep(0)
print("No timeout!")
async with asyncio.timeout(0):
await asyncio.sleep(0) # TimeoutError
asyncio.run(main())
I think it would be better to fix the negative time.
Make sense, I'll find a way to patch it |
Signed-off-by: Manjusaka <[email protected]>
Signed-off-by: Manjusaka <[email protected]>
Signed-off-by: Manjusaka <[email protected]>
Signed-off-by: Manjusaka <[email protected]>
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.
I think your documentation addition is useful, but the logic change is not what we want.
If you want a cleaner value in the TimeoutExpired error message in this situation, that could be done by catching and replacing the info in the TimeoutExpired exception from Popen._communicate's self.wait(timeout=self._remaining_time(endtime))
with the orig_timeout value that is known at that point. .wait()
itself cannot meaningfully know that value.
A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated. Once you have made the requested changes, please leave a comment on this pull request containing the phrase |
Signed-off-by: Manjusaka <[email protected]>
Signed-off-by: Manjusaka <[email protected]>
subprocess.run
's behavior is same with 'timeout=None' when the timeout is zeroTimeoutExpired
when the func subprocess.run
is called with a timeout
Signed-off-by: Manjusaka <[email protected]>
Signed-off-by: Manjusaka <[email protected]>
Signed-off-by: Manjusaka <[email protected]>
Signed-off-by: Manjusaka <[email protected]>
TimeoutExpired
when the func subprocess.run
is called with a timeoutTimeoutExpired
when the func subprocess.run
is called with a timeout
… the func `subprocess.run` is called with a timeout (pythonGH-133103) (cherry picked from commit 2bbcaed) Co-authored-by: Nadeshiko Manju <[email protected]> Signed-off-by: Manjusaka <[email protected]> Co-authored-by: Gregory P. Smith <[email protected]>
GH-133418 is a backport of this pull request to the 3.13 branch. |
…n the func `subprocess.run` is called with a timeout (GH-133103) (#133418) gh-133089: Use original timeout value for `TimeoutExpired` when the func `subprocess.run` is called with a timeout (GH-133103) (cherry picked from commit 2bbcaed) Signed-off-by: Manjusaka <[email protected]> Co-authored-by: Nadeshiko Manju <[email protected]> Co-authored-by: Gregory P. Smith <[email protected]>
|
|
|
|
|
|
|
|
|
|
The few buildbot failures on python#133103 are possibly just due to racing a child process launch and exit?
The few buildbot failures on #133103 are possibly just due to racing a child process launch and exit?
…GH-133420) The few buildbot failures on python#133103 are possibly just due to racing a child process launch and exit? (cherry picked from commit b64aa30) Co-authored-by: Gregory P. Smith <[email protected]>
Fix #133089
subprocess.run
'sTimeoutExpired
exception when settingtimeout=0
#133089