Skip to content

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

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

Writtic
Copy link

@Writtic Writtic commented Aug 15, 2025

@python-cla-bot
Copy link

python-cla-bot bot commented Aug 15, 2025

All commit authors signed the Contributor License Agreement.

CLA signed

proc.wait()
try:
proc.wait()
except ProcessLookupError:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Author

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.

Copy link
Author

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')
Copy link
Member

@corona10 corona10 Aug 15, 2025

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants