Version compatibility update#757
Open
mgelde wants to merge 2 commits into
Open
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
masterand 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.