-
-
Notifications
You must be signed in to change notification settings - Fork 32.6k
gh-96863: Fix subprocess.Popen.wait to raise ProcessLookupError for external waits #137804
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
proc.wait() | ||
try: | ||
proc.wait() | ||
except ProcessLookupError: |
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.
Would you like to use https://docs.python.org/3/library/unittest.html#unittest.TestCase.assertRaises if it is always happened?
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.
Thanks! I’ll use assertRaises here.
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.
It seems it’s not always raised, so I’ll revert to using a try–except block on cb8d874.
sts = 0 | ||
return (pid, sts) | ||
|
||
raise ProcessLookupError(f'Process {self.pid} is already waited on externally') |
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.
@gpshead I think that we should specify status code rather than raise exception because it will change current behavior. WDYT?
Patch for the Issue: #96863