py3: move xrange alias next to import lines
authorYuya Nishihara <yuya@tcha.org>
Sun, 14 Aug 2016 12:41:54 +0900
changeset 29797 965c91bad9e3
parent 29796 6ab838b20359
child 29798 31d588fcd2b9
py3: move xrange alias next to import lines Builtin functions should be available in compatibility code.
mercurial/pycompat.py
--- a/mercurial/pycompat.py	Tue Aug 16 17:15:54 2016 +0900
+++ b/mercurial/pycompat.py	Sun Aug 14 12:41:54 2016 +0900
@@ -29,6 +29,12 @@
     import urllib.parse as urlparse
     import xmlrpc.client as xmlrpclib
 
+try:
+    xrange
+except NameError:
+    import builtins
+    builtins.xrange = range
+
 stringio = io.StringIO
 empty = _queue.Empty
 queue = _queue.Queue
@@ -143,9 +149,3 @@
         "SimpleHTTPRequestHandler",
         "CGIHTTPRequestHandler",
     ))
-
-try:
-    xrange
-except NameError:
-    import builtins
-    builtins.xrange = range