Mercurial > hg
changeset 36940:b0ffcb540357
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
author | Augie Fackler <augie@google.com> |
---|---|
date | Tue, 13 Mar 2018 18:04:37 -0400 |
parents | 45bfcd16f27e |
children | 3f7bbce8fbaa |
files | mercurial/commandserver.py |
diffstat | 1 files changed, 8 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- 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