Gentoo Archives: gentoo-portage-dev

From: Zac Medico <zmedico@g.o>
To: gentoo-portage-dev@l.g.o, Matt Turner <mattst88@g.o>
Subject: Re: [gentoo-portage-dev] [PATCH] Use asyncio.subprocess.Process directly
Date: Sat, 06 Mar 2021 09:40:22
Message-Id: 796589c8-dc82-30ea-7501-5c97b06d2e3f@gentoo.org
In Reply to: [gentoo-portage-dev] [PATCH] Use asyncio.subprocess.Process directly by Matt Turner
1 On 3/4/21 11:24 AM, Matt Turner wrote:
2 > With no need to support Python 2, we can remove our private
3 > implementation.
4 >
5 > Signed-off-by: Matt Turner <mattst88@g.o>
6 > ---
7 > I don't know how to test this. I intentionally broke the return value of
8 > create_subprocess_exec and didn't see any bad results.
9 >
10 > lib/portage/util/futures/_asyncio/__init__.py | 8 +-
11 > lib/portage/util/futures/_asyncio/process.py | 116 ------------------
12 > 2 files changed, 4 insertions(+), 120 deletions(-)
13 > delete mode 100644 lib/portage/util/futures/_asyncio/process.py
14
15 Merged, thanks!
16
17 https://gitweb.gentoo.org/proj/portage.git/commit/?id=1e843f853a9afe82d599e6ab09064147ddc1d271
18
19
20 > diff --git a/lib/portage/util/futures/_asyncio/__init__.py b/lib/portage/util/futures/_asyncio/__init__.py
21 > index 5590963f1..207e7205d 100644
22 > --- a/lib/portage/util/futures/_asyncio/__init__.py
23 > +++ b/lib/portage/util/futures/_asyncio/__init__.py
24 > @@ -25,6 +25,7 @@ import types
25 > import weakref
26 >
27 > import asyncio as _real_asyncio
28 > +from asyncio.subprocess import Process
29 >
30 > try:
31 > import threading
32 > @@ -138,7 +138,7 @@ def create_subprocess_exec(*args, **kwargs):
33 >
34 > result = loop.create_future()
35 >
36 > - result.set_result(_Process(subprocess.Popen(
37 > + result.set_result(Process(subprocess.Popen(
38 > args,
39 > stdin=kwargs.pop('stdin', None),
40 > stdout=kwargs.pop('stdout', None),
41
42 The above area is actually no longer used, since we should always have a
43 _AsyncioEventLoop instance here, and we can remove the EventLoop class now.
44 --
45 Thanks,
46 Zac

Attachments

File name MIME type
signature.asc application/pgp-signature