bbdffce563aa — Alain Leufroy a month ago
process.py: fix python 3.10 compat

See https://docs.python.org/3/whatsnew/3.10.html#removed

"The loop parameter has been removed from most of asyncio‘s high-level API"
1 files changed, 6 insertions(+), 2 deletions(-)

M lairucrem/process.py
M lairucrem/process.py +6 -2
@@ 9,11 9,12 @@ import asyncio
 import os
 import shlex
 import sys
+from sys import version_info
 from typing import AsyncIterable
 
 from . import config, get_extension_path, interrupt_mainloop
 from .config import get_hg
-from .exceptions import HgNotFoundError, RepositoryNotFound, CriticalError
+from .exceptions import CriticalError, HgNotFoundError, RepositoryNotFound
 
 #
 

          
@@ 75,9 76,12 @@ class hg:
                 args += ('--traceback',)
             args += self.args
             self.cmd = ' '.join(shlex.quote(a) for a in args)
+            kwargs = self.kwargs.copy()
+            if version_info[:2] < (3, 10):
+                kwargs['loop'] = asyncio.get_event_loop()
             try:
                 self.proc = await asyncio.create_subprocess_exec(
-                    *args, loop=asyncio.get_event_loop(), **self.kwargs
+                    *args, **self.kwargs
                 )
             except FileNotFoundError as exc:
                 raise HgNotFoundError() from exc