mercurial/commandserver.py
changeset 36940 b0ffcb540357
parent 36835 5bc7ff103081
child 37119 d4a2e0d5d042
--- a/mercurial/commandserver.py	Sat Mar 10 12:33:19 2018 +0530
+++ b/mercurial/commandserver.py	Tue Mar 13 18:04:37 2018 -0400
@@ -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