Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork34.2k
gh-145541: Fix InvalidStateError in BaseSubprocessTransport._call_connection_lost()#145554
gh-145541: Fix InvalidStateError in BaseSubprocessTransport._call_connection_lost()#145554daandemeyer wants to merge 2 commits intopython:mainfrom
Conversation
Most changes to Pythonrequire a NEWS entry. Add one using theblurb_it web app or theblurb command-line tool. If this change has little impact on Python users, wait for a maintainer to apply the |
python-cla-botbot commentedMar 5, 2026 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
vstinner commentedMar 5, 2026
Please set a more useful title than "wip" for your PR draft. |
Most changes to Pythonrequire a NEWS entry. Add one using theblurb_it web app or theblurb command-line tool. If this change has little impact on Python users, wait for a maintainer to apply the |
…ll_connection_lost()Change `if not waiter.cancelled()` to `if not waiter.done()` in both_try_finish() and _call_connection_lost() so that waiters whose resultwas already set by _try_finish() are not set again by_call_connection_lost(), which would raise InvalidStateError.When _connect_pipes is cancelled (e.g. by SIGINT during subprocesscreation), _pipes_connected stays False. If the process then exits,_try_finish() sets the result on exit waiters because _pipes_connectedis False, and then schedules _call_connection_lost() because all pipesare disconnected. _call_connection_lost() must skip waiters that arealready done.
Most changes to Pythonrequire a NEWS entry. Add one using theblurb_it web app or theblurb command-line tool. If this change has little impact on Python users, wait for a maintainer to apply the |
Uh oh!
There was an error while loading.Please reload this page.
Change
if not waiter.cancelled()toif not waiter.done()in both_try_finish() and _call_connection_lost() so that waiters whose result
was already set by _try_finish() are not set again by
_call_connection_lost(), which would raise InvalidStateError.
When _connect_pipes is cancelled (e.g. by SIGINT during subprocess
creation), _pipes_connected stays False. If the process then exits,
_try_finish() sets the result on exit waiters because _pipes_connected
is False, and then schedules _call_connection_lost() because all pipes
are disconnected. _call_connection_lost() must skip waiters that are
already done.