# HG changeset patch # User Augie Fackler # Date 2018-03-13 22:04:37 # Node ID b0ffcb5403573a47ad6be3db08a4bc4e1d43c87b # Parent 45bfcd16f27e6d5988dfa8b2165bede17b41468c commandserver: prefer first-party selectors module from Python 3 to backport Caught by some deprecation warnings on Python 3.7. Differential Revision: https://phab.mercurial-scm.org/D2844 diff --git a/mercurial/commandserver.py b/mercurial/commandserver.py --- a/mercurial/commandserver.py +++ b/mercurial/commandserver.py @@ -16,8 +16,13 @@ import socket 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 @@ class unixforkingservice(object): 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