util: correct check of sys.version_info
authorAugie Fackler <augie@google.com>
Fri, 07 Oct 2016 08:01:16 -0400
changeset 30053 dbcef8918bbd
parent 30052 eaaedad68011
child 30054 8b89521a69ba
util: correct check of sys.version_info sys.version is a string, and shouldn't be compared against a tuple for version comparisons. This was always true, so we were never disabling gc on 2.6. >>> (2, 7) >= '2.7' True >>> (2, 6) >= '2.7' True
mercurial/util.py
tests/test-check-py3-compat.t
--- a/mercurial/util.py	Fri Oct 07 15:29:57 2016 +0200
+++ b/mercurial/util.py	Fri Oct 07 08:01:16 2016 -0400
@@ -881,7 +881,7 @@
 
     This garbage collector issue have been fixed in 2.7.
     """
-    if sys.version >= (2, 7):
+    if sys.version_info >= (2, 7):
         return func
     def wrapper(*args, **kwargs):
         gcenabled = gc.isenabled()
--- a/tests/test-check-py3-compat.t	Fri Oct 07 15:29:57 2016 +0200
+++ b/tests/test-check-py3-compat.t	Fri Oct 07 08:01:16 2016 -0400
@@ -162,10 +162,10 @@
   mercurial/ui.py: error importing: <TypeError> int() can't convert non-string with explicit base (error at util.py:*)
   mercurial/unionrepo.py: error importing: <TypeError> int() can't convert non-string with explicit base (error at util.py:*)
   mercurial/url.py: error importing: <TypeError> int() can't convert non-string with explicit base (error at util.py:*)
-  mercurial/verify.py: error importing module: <TypeError> unorderable types: str() >= tuple() (line *)
+  mercurial/verify.py: error importing: <TypeError> a bytes-like object is required, not 'str' (error at revset.py:*)
   mercurial/win32.py: error importing module: <ImportError> No module named 'msvcrt' (line *)
   mercurial/windows.py: error importing module: <ImportError> No module named 'msvcrt' (line *)
-  mercurial/wireproto.py: error importing module: <TypeError> unorderable types: str() >= tuple() (line *)
+  mercurial/wireproto.py: error importing: <TypeError> a bytes-like object is required, not 'str' (error at revset.py:*)
 
 #endif