Message ID | 20191207003333.3228-4-yang.zhao@skyboxlabs.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | git-p4: python3 compatibility | expand |
diff --git a/git-p4.py b/git-p4.py index d8f88884db..ebeef35a92 100755 --- a/git-p4.py +++ b/git-p4.py @@ -27,18 +27,9 @@ import errno # support basestring in python3 -try: - unicode = unicode -except NameError: - # 'unicode' is undefined, must be Python 3 - str = str - unicode = str - bytes = bytes +if sys.version_info.major >= 3: basestring = (str,bytes) else: - # 'unicode' exists, must be Python 2 - str = str - unicode = unicode bytes = str basestring = basestring
Instead of type shenanigans, just check the version object. Signed-off-by: Yang Zhao <yang.zhao@skyboxlabs.com> --- git-p4.py | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-)