D2844: commandserver: prefer first-party selectors module from Python 3 to backport

durin42 (Augie Fackler) phabricator at mercurial-scm.org
Wed Mar 14 09:51:51 EDT 2018


This revision was automatically updated to reflect the committed changes.
Closed by commit rHGb3c15f0eb984: commandserver: prefer first-party selectors module from Python 3 to backport (authored by durin42, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D2844?vs=7001&id=7025

REVISION DETAIL
  https://phab.mercurial-scm.org/D2844

AFFECTED FILES
  mercurial/commandserver.py

CHANGE DETAILS

diff --git a/mercurial/commandserver.py b/mercurial/commandserver.py
--- a/mercurial/commandserver.py
+++ b/mercurial/commandserver.py
@@ -16,8 +16,13 @@
 import struct
 import traceback
 
+try:
+    import selectors
+    selectors.BaseSelector
+except ImportError:
+    from .thirdparty import selectors2 as selectors
+
 from .i18n import _
-from .thirdparty import selectors2
 from . import (
     encoding,
     error,
@@ -476,8 +481,8 @@
     def _mainloop(self):
         exiting = False
         h = self._servicehandler
-        selector = selectors2.DefaultSelector()
-        selector.register(self._sock, selectors2.EVENT_READ)
+        selector = selectors.DefaultSelector()
+        selector.register(self._sock, selectors.EVENT_READ)
         while True:
             if not exiting and h.shouldexit():
                 # clients can no longer connect() to the domain socket, so



To: durin42, #hg-reviewers, yuja
Cc: mercurial-devel


More information about the Mercurial-devel mailing list