Skip to content

Version compatibility update#757

Open
mgelde wants to merge 2 commits into
KimiNewt:masterfrom
mgelde:version_compatibility_update
Open

Version compatibility update#757
mgelde wants to merge 2 commits into
KimiNewt:masterfrom
mgelde:version_compatibility_update

Conversation

@mgelde

@mgelde mgelde commented Jun 4, 2026

Copy link
Copy Markdown

Most recent Python versions removed parts of the API used in capture.py. This patch restores compatibility.

For more recent Python versions, this patch removes usage of the removed ChildWatcher APIs (and of the deprecated Policies) and simply retrieves or creates the event loop in the recommended way.

As far as I can tell, there is not gap in functionality: Using a SafeChildWatcher instead of ThreadedChildWatcher on Unix systems suppressed an error message about already awaited children, but did not resolve the underlying issue (calling wait on the same PID multiple times), which is moreover an uncritical condition (as noted in the commit that introduced SafeChildWatcher as a workaround). In any case: The redundant wait seems to be due to code that awaits the child manually via communicate() or similar. This is not a bug and IMO it's a bit odd that this causes a warning.

In most recent versions of the Python asyncio APIs, it is no longer possible to change the ChildWatcher in this fashion anyways, and API version 3.14 no longer has a SafeChildWatcher, not even internally.

The tests did not show any regressions, but one test failed due to a picking issue (logger cannot be picked). That test did not fail with master and Python 3.12, but now fails for some reason. I do not believe this is related to this patch, though. Nevertheless, I fixed that test by avoiding the picking operation. All tests now pass.

mgelde added 2 commits June 4, 2026 13:34
Most recent Python versions removed parts of the API used in capture.py.
This patch restores compatibility.

For more recent Python versions, this patch removes usage of the removed
ChildWatcher APIs (and of the deprecated Policies) and simply retrieves
or creates the event loop in the recommended way.

As far as I can tell, there is not gap in functionality: Using a
SafeChildWatcher instead of ThreadedChildWatcher on Unix systems
suppressed an error message about already awaited children, but did not
resolve the underlying issue (calling wait on the same PID multiple
times), which is moreover an uncritical condition.

In most recent versions of the Python asyncio APIs, it is not longer
possible to change the ChildWatcher in this fashion anyways, and API
version >= 3.14 no longer has a SafeChildWatcher, even internally.
One test uses multiprocessing and fails due to a pickling error. This
patch moves the creation of the capture instance into the new process
thereby eliminating the need for pickling a capture object.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant