changeset 48869:57b58413dad1

pycompat: remove first not ispy3 block We now require Python 3. So we can remove the first block supporting Python 2. Differential Revision: https://phab.mercurial-scm.org/D12247
author Gregory Szorc <gregory.szorc@gmail.com>
date Wed, 02 Mar 2022 17:51:27 -0800
parents a52f5bfc9358
children df56e6bd37f6
files mercurial/pycompat.py
diffstat 1 files changed, 11 insertions(+), 24 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/pycompat.py	Sun Feb 20 13:43:44 2022 -0700
+++ b/mercurial/pycompat.py	Wed Mar 02 17:51:27 2022 -0800
@@ -10,13 +10,21 @@
 
 from __future__ import absolute_import
 
+import builtins
+import concurrent.futures as futures
 import getopt
+import http.client as httplib
+import http.cookiejar as cookielib
 import inspect
 import json
 import os
+import pickle
+import queue
 import shlex
+import socketserver
 import sys
 import tempfile
+import xmlrpc.client as xmlrpclib
 
 ispy3 = sys.version_info[0] >= 3
 ispypy = '__pypy__' in sys.builtin_module_names
@@ -27,33 +35,12 @@
 
     TYPE_CHECKING = typing.TYPE_CHECKING
 
-if not ispy3:
-    import cookielib
-    import cPickle as pickle
-    import httplib
-    import Queue as queue
-    import SocketServer as socketserver
-    import xmlrpclib
-
-    def future_set_exception_info(f, exc_info):
-        f.set_exception_info(*exc_info)
-
-    # this is close enough for our usage
-    FileNotFoundError = OSError
 
-else:
-    import builtins
-    import http.cookiejar as cookielib
-    import http.client as httplib
-    import pickle
-    import queue as queue
-    import socketserver
-    import xmlrpc.client as xmlrpclib
+def future_set_exception_info(f, exc_info):
+    f.set_exception(exc_info[0])
 
-    def future_set_exception_info(f, exc_info):
-        f.set_exception(exc_info[0])
 
-    FileNotFoundError = builtins.FileNotFoundError
+FileNotFoundError = builtins.FileNotFoundError
 
 
 def identity(a):