Skip to content
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

bpo-35621: Support running subprocesses in asyncio when loop is executed in non-main thread #14344

Merged
merged 17 commits into from Jun 30, 2019

Conversation

asvetlov
Copy link
Contributor

@asvetlov asvetlov commented Jun 24, 2019

The resurrection of #13630
Now without dangling threads in tests :)

https://bugs.python.org/issue35621

@asvetlov
Copy link
Contributor Author

asvetlov commented Jun 24, 2019

I tested it with manual adding 1-second timeout in spawned waiter threads to emulate slow test machine.
After making sure that ./python -Werror -m test -v --fail-env-changed test_asyncio doesn't produce an error I removed the sleep.

@@ -1035,11 +1052,6 @@ def __exit__(self, a, b, c):
def add_child_handler(self, pid, callback, *args):
assert self._forks, "Must use the context manager"

if self._loop is None:
Copy link
Contributor Author

@asvetlov asvetlov Jun 24, 2019

Choose a reason for hiding this comment

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

The check is replaced by watcher.is_active() call in subprocess transport

1st1
1st1 approved these changes Jun 30, 2019
Copy link
Member

@1st1 1st1 left a comment

LGTM overall. Thanks for pushing this through, Andrew.

Doc/library/asyncio-policy.rst Outdated Show resolved Hide resolved
Doc/library/asyncio-policy.rst Outdated Show resolved Hide resolved
Doc/library/asyncio-policy.rst Outdated Show resolved Hide resolved
Doc/library/asyncio-policy.rst Outdated Show resolved Hide resolved
Doc/library/asyncio-policy.rst Outdated Show resolved Hide resolved
Doc/library/asyncio-subprocess.rst Show resolved Hide resolved
Lib/asyncio/unix_events.py Outdated Show resolved Hide resolved
Lib/asyncio/unix_events.py Outdated Show resolved Hide resolved
asvetlov and others added 8 commits Jun 30, 2019
Co-Authored-By: Yury Selivanov <yury@magic.io>
Co-Authored-By: Yury Selivanov <yury@magic.io>
Co-Authored-By: Yury Selivanov <yury@magic.io>
Co-Authored-By: Yury Selivanov <yury@magic.io>
Co-Authored-By: Yury Selivanov <yury@magic.io>
Co-Authored-By: Yury Selivanov <yury@magic.io>
@asvetlov
Copy link
Contributor Author

asvetlov commented Jun 30, 2019

Thanks for review!

@asvetlov asvetlov merged commit 0d671c0 into python:master Jun 30, 2019
@miss-islington
Copy link
Contributor

miss-islington commented Jun 30, 2019

Thanks @asvetlov for the PR 🌮🎉.. I'm working now to backport this PR to: 3.8.
🐍🍒🤖

@asvetlov asvetlov deleted the threaded-waiter branch Jun 30, 2019
@bedevere-bot
Copy link

bedevere-bot commented Jun 30, 2019

GH-14484 is a backport of this pull request to the 3.8 branch.

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Jun 30, 2019
…ted in non-main thread (pythonGH-14344)

(cherry picked from commit 0d671c0)

Co-authored-by: Andrew Svetlov <andrew.svetlov@gmail.com>
miss-islington added a commit that referenced this pull request Jun 30, 2019
…ted in non-main thread (GH-14344)

(cherry picked from commit 0d671c0)

Co-authored-by: Andrew Svetlov <andrew.svetlov@gmail.com>
lisroach pushed a commit to lisroach/cpython that referenced this pull request Sep 10, 2019
DinoV pushed a commit to DinoV/cpython that referenced this pull request Jan 14, 2020
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.

None yet

5 participants