Re: [PATCH] Use asyncio.subprocess.Process directly

Zac Medico <[email protected]> Sat, 6 Mar 2021 01:40:17 -0800
Newsgroups gmane.linux.gentoo.portage.devel
Message-ID <[email protected]>
On 3/4/21 11:24 AM, Matt Turner wrote:
> With no need to support Python 2, we can remove our private
> implementation.
> 
> Signed-off-by: Matt Turner <[email protected]>
> ---
> I don't know how to test this. I intentionally broke the return value of
> create_subprocess_exec and didn't see any bad results.
> 
>  lib/portage/util/futures/_asyncio/__init__.py |   8 +-
>  lib/portage/util/futures/_asyncio/process.py  | 116 ------------------
>  2 files changed, 4 insertions(+), 120 deletions(-)
>  delete mode 100644 lib/portage/util/futures/_asyncio/process.py

Merged, thanks!

https://gitweb.gentoo.org/proj/portage.git/commit/?id=1e843f853a9afe82d599e6ab09064147ddc1d271


> diff --git a/lib/portage/util/futures/_asyncio/__init__.py b/lib/portage/util/futures/_asyncio/__init__.py
> index 5590963f1..207e7205d 100644
> --- a/lib/portage/util/futures/_asyncio/__init__.py
> +++ b/lib/portage/util/futures/_asyncio/__init__.py
> @@ -25,6 +25,7 @@ import types
>  import weakref
>  
>  import asyncio as _real_asyncio
> +from asyncio.subprocess import Process
>  
>  try:
>  	import threading
> @@ -138,7 +138,7 @@ def create_subprocess_exec(*args, **kwargs):
>  
>  	result = loop.create_future()
>  
> -	result.set_result(_Process(subprocess.Popen(
> +	result.set_result(Process(subprocess.Popen(
>  		args,
>  		stdin=kwargs.pop('stdin', None),
>  		stdout=kwargs.pop('stdout', None),

The above area is actually no longer used, since we should always have a
_AsyncioEventLoop instance here, and we can remove the EventLoop class now.
-- 
Thanks,
Zac
signature.asc (application/pgp-signature, 981 B)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2

iQKTBAEBCgB9FiEE8OgXaltWzqgSupCu0HX7jBBKPSAFAmBDTgFfFIAAAAAALgAo
aXNzdWVyLWZwckBub3RhdGlvbnMub3BlbnBncC5maWZ0aGhvcnNlbWFuLm5ldEYw
RTgxNzZBNUI1NkNFQTgxMkJBOTBBRUQwNzVGQjhDMTA0QTNEMjAACgkQ0HX7jBBK
PSB0oQ//QsxDS6CTPyJimmKpK4A4HdkcwFc0qUz01QyaGqe+YyGN15EYDrnesgh/
qtRZr3lsC/WCMr3VcE6MRCOBSXsdaGtLf83X6m7NrSUFnXrqEXHbr9SlGwSmpEoP
AKEWV3vNi+lGyxfkFAzEv5EO+BpVaYT7aO55MaezSIF45CwT570+JhGCEHcNxYOH
xt5dhtskikzRlMQZHcIZlJiwV5wNZZ70cI+YsyZu2kcXayda+igEBQp45FOwOYk0
YIV6kdWpYyyKUBXA/p7tFqBqCqaLcs6oh1hdaUr2OMnuWJXBTllvfKCcnb+d9w1l
xHm1j2X7qoChwAqxz4BbKd9YS2PT39DHRCAgwgguoZoQswbzWC44Iv/EPmkLWcq5
jw1tHQs0O4+k7i5du5iRm04ciwldTJCMdR6wLpQQewXo4RoMxAaLrpHdhQP+YdZd
aEnPdiRV3W4m2lJzLBFog/fk+XYeSd+JBmNGbev6qrB8m1TCxkGAnoM7A23gMPA3
G2E67It2sYfgnSNOw1Cq7vaBDzPB9rvd2KlFoWHMwHgT3vcjjMxBhDK505Sw2gKT
8NA/Jq2sz5THUv7m4ipYdayB0SMxiHvrfvLxDquDu7Kjbj3aPI/FBOmAZYr/nhhw
CAvwpijeoJWtVFlS4kEIlMrfAiMx3bbr3Z4RGVK7GajGsBa5C80=
=c78o
-----END PGP SIGNATURE-----