From patchwork Sun Aug 14 09:33:47 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [3,of,4,RFC] pycompat: check python version to enable builtins hack From: Yuya Nishihara X-Patchwork-Id: 16278 Message-Id: To: mercurial-devel@mercurial-scm.org Date: Sun, 14 Aug 2016 18:33:47 +0900 # HG changeset patch # User Yuya Nishihara # Date 1471146253 -32400 # Sun Aug 14 12:44:13 2016 +0900 # Node ID d53bd633898ec6edafccea9f798d314699faf90a # Parent 76c2c6169dccde84f84a46b7f366020bc3e72959 pycompat: check python version to enable builtins hack Future patches will add getattr/setattr wrappers. 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