changeset 153:ef8eb78fc88d

hglib: don't try to use long under Python 3 (issue4520)
author Brett Cannon <brett@python.org>
date Fri, 20 Mar 2015 16:34:42 -0400
parents 0808bb03add5
children 11202c85737e
files hglib/context.py hglib/util.py
diffstat 2 files changed, 4 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/hglib/context.py	Fri Mar 20 16:32:53 2015 -0400
+++ b/hglib/context.py	Fri Mar 20 16:34:42 2015 -0400
@@ -1,7 +1,7 @@
 import hglib.client  # Circular dependency.
 from hglib import util, templates
 from hglib.error import CommandError
-from hglib.util import b, strtobytes
+from hglib.util import b, strtobytes, integertypes
 
 _nullcset = [b('-1'), b('0000000000000000000000000000000000000000'), b(''),
              b(''), b(''), b(''), b('')]
@@ -19,7 +19,7 @@
         elif changeid == -1:
             cset = _nullcset
         else:
-            if isinstance(changeid, (long, int)):
+            if isinstance(changeid, integertypes):
                 changeid = b('rev(') + strtobytes(changeid) + b(')')
 
             notfound = False
--- a/hglib/util.py	Fri Mar 20 16:32:53 2015 -0400
+++ b/hglib/util.py	Fri Mar 20 16:34:42 2015 -0400
@@ -7,12 +7,14 @@
 
 if sys.version_info[0] > 2:
     izip = zip
+    integertypes = (int,)
 
     def b(s):
         """Encode the string as bytes."""
         return s.encode('latin-1')
 else:
     from itertools import izip
+    integertypes = (long, int)
 
     def b(s):
         """Encode the string as bytes."""