Patchwork [3,of,5,V2] py3: check python version to enable builtins hack

login
register
mail settings
Submitter Yuya Nishihara
Date Aug. 16, 2016, 8:50 a.m.
Message ID <c3639410ef41ee95ce79.1471337444@mimosa>
Download mbox | patch
Permalink /patch/16320/
State Accepted
Headers show

Comments

Yuya Nishihara - Aug. 16, 2016, 8:50 a.m.
# HG changeset patch
# User Yuya Nishihara <yuya@tcha.org>
# Date 1471146253 -32400
#      Sun Aug 14 12:44:13 2016 +0900
# Node ID c3639410ef41ee95ce795ac1a461889feb9f9cf5
# Parent  72d31f469f3b89eddd3f138af567bed3a9fac0a7
py3: check python version to enable builtins hack

Future patches will add (del|get|has|set)attr wrappers.

Patch

diff --git a/mercurial/pycompat.py b/mercurial/pycompat.py
--- a/mercurial/pycompat.py
+++ b/mercurial/pycompat.py
@@ -29,9 +29,7 @@  else:
     import urllib.parse as urlparse
     import xmlrpc.client as xmlrpclib
 
-try:
-    xrange
-except NameError:
+if sys.version_info[0] >= 3:
     import builtins
     builtins.xrange = range