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

login
register
mail settings
Submitter phabricator
Date March 14, 2018, 1:51 p.m.
Message ID <6721384f106d5a8700b5eb3a362b891d@localhost.localdomain>
Download mbox | patch
Permalink /patch/29487/
State Not Applicable
Headers show

Comments

phabricator - March 14, 2018, 1:51 p.m.
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




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

Patch

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