diff mercurial/commandserver.py @ 49288:311fcc5a65f6

thirdparty: remove Python 2-specific selectors2 copy The selectors module was added in Python 3.4. Because we require Python 3.6, it will always be available. Therefore the selectors2 module is not imported. I?ve verified that the selectors2-specific workaround in commandserver.py is not necessary with the selectors module from the standard library. It returns an empty list if timeout was exceeded. The pytype directive was needed to silence the following error: File "/tmp/mercurial-ci/mercurial/worker.py", line 299, in _posixworker: No attribute 'close' on int [attribute-error] In Union[_typeshed.HasFileno, int] File "/tmp/mercurial-ci/mercurial/worker.py", line 299, in _posixworker: No attribute 'close' on _typeshed.HasFileno [attribute-error] In Union[_typeshed.HasFileno, int]
author Manuel Jacob <me@manueljacob.de>
date Sat, 28 May 2022 22:08:13 +0200
parents 642e31cb55f0
children ee4537e365c8
line wrap: on
line diff
--- a/mercurial/commandserver.py	Wed Jun 08 15:46:04 2022 +0200
+++ b/mercurial/commandserver.py	Sat May 28 22:08:13 2022 +0200
@@ -10,18 +10,12 @@
 import gc
 import os
 import random
+import selectors
 import signal
 import socket
 import struct
 import traceback
 
-try:
-    import selectors
-
-    selectors.BaseSelector
-except ImportError:
-    from .thirdparty import selectors2 as selectors
-
 from .i18n import _
 from .pycompat import getattr
 from . import (
@@ -644,15 +638,7 @@
                 # waiting for recv() will receive ECONNRESET.
                 self._unlinksocket()
                 exiting = True
-            try:
-                events = selector.select(timeout=h.pollinterval)
-            except OSError as inst:
-                # selectors2 raises ETIMEDOUT if timeout exceeded while
-                # handling signal interrupt. That's probably wrong, but
-                # we can easily get around it.
-                if inst.errno != errno.ETIMEDOUT:
-                    raise
-                events = []
+            events = selector.select(timeout=h.pollinterval)
             if not events:
                 # only exit if we completed all queued requests
                 if exiting: