diff mercurial/encoding.py @ 30031:0f6d6fdd3c2a

pycompat: provide 'ispy3' constant We compare version_info at several places, which seems enough to define a constant.
author Yuya Nishihara <yuya@tcha.org>
date Wed, 28 Sep 2016 20:01:23 +0900
parents 3c6e94d0811c
children 02dbfaa6df0b
line wrap: on
line diff
--- a/mercurial/encoding.py	Fri Sep 30 00:27:35 2016 +0200
+++ b/mercurial/encoding.py	Wed Sep 28 20:01:23 2016 +0900
@@ -10,14 +10,14 @@
 import array
 import locale
 import os
-import sys
 import unicodedata
 
 from . import (
     error,
+    pycompat,
 )
 
-if sys.version_info[0] >= 3:
+if pycompat.ispy3:
     unichr = chr
 
 # These unicode characters are ignored by HFS+ (Apple Technote 1150,
@@ -27,7 +27,7 @@
            "200c 200d 200e 200f 202a 202b 202c 202d 202e "
            "206a 206b 206c 206d 206e 206f feff".split()]
 # verify the next function will work
-if sys.version_info[0] >= 3:
+if pycompat.ispy3:
     assert set(i[0] for i in _ignore) == set([ord(b'\xe2'), ord(b'\xef')])
 else:
     assert set(i[0] for i in _ignore) == set(["\xe2", "\xef"])