[PATCH 03/13] git-p4: simplify python version detection
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(-)
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
--
2.21.0.windows.1