[PATCH 3 of 4 RFC] pycompat: check python version to enable builtins hack
Yuya Nishihara
yuya at tcha.org
Sun Aug 14 09:33:47 UTC 2016
# HG changeset patch
# User Yuya Nishihara <yuya at tcha.org>
# 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
More information about the Mercurial-devel
mailing list