From: Kefu Chai Date: Thu, 13 Apr 2017 07:25:34 +0000 (+0800) Subject: pybind: use sys.version_info for checking py3 X-Git-Tag: v12.0.3~122^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=801c5c4e26a63c9d4f9e3170377922ef8e147275;p=ceph.git pybind: use sys.version_info for checking py3 it's simpler and more consistent with other part of ceph. Signed-off-by: Kefu Chai --- diff --git a/src/pybind/cephfs/cephfs.pyx b/src/pybind/cephfs/cephfs.pyx index b7b406cd95e3..746b9e8da573 100644 --- a/src/pybind/cephfs/cephfs.pyx +++ b/src/pybind/cephfs/cephfs.pyx @@ -16,9 +16,7 @@ import os import sys # Are we running Python 2.x -_python2 = sys.hexversion < 0x03000000 - -if _python2: +if sys.version_info[0] < 3: str_type = basestring else: str_type = str diff --git a/src/pybind/rados/rados.pyx b/src/pybind/rados/rados.pyx index 586dc7458d2d..47d362e972ac 100644 --- a/src/pybind/rados/rados.pyx +++ b/src/pybind/rados/rados.pyx @@ -28,9 +28,7 @@ from functools import partial, wraps from itertools import chain # Are we running Python 2.x -_python2 = sys.hexversion < 0x03000000 - -if _python2: +if sys.version_info[0] < 3: str_type = basestring else: str_type = str diff --git a/src/test/pybind/test_rados.py b/src/test/pybind/test_rados.py index 50b09053cdd0..a4e1efd852ee 100644 --- a/src/test/pybind/test_rados.py +++ b/src/test/pybind/test_rados.py @@ -11,7 +11,7 @@ import errno import sys # Are we running Python 2.x -_python2 = sys.hexversion < 0x03000000 +_python2 = sys.version_info[0] < 3 def test_rados_init_error(): assert_raises(Error, Rados, conffile='', rados_id='admin',