From: Luke Diamand Date: Tue, 19 Jun 2018 08:04:09 +0000 (+0100) Subject: git-p4: python3: basestring workaround X-Git-Tag: v2.19.0-rc0~163^2~2 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/efdcc99263871818cfe297a5a981d5841c77ebac git-p4: python3: basestring workaround In Python3, basestring no longer exists, so use this workaround. Signed-off-by: Luke Diamand Signed-off-by: Junio C Hamano --- diff --git a/git-p4.py b/git-p4.py index 67865d14aa..f127ebce27 100755 --- a/git-p4.py +++ b/git-p4.py @@ -27,6 +27,22 @@ import ctypes import errno +# support basestring in python3 +try: + unicode = unicode +except NameError: + # 'unicode' is undefined, must be Python 3 + str = str + unicode = str + bytes = bytes + basestring = (str,bytes) +else: + # 'unicode' exists, must be Python 2 + str = str + unicode = unicode + bytes = str + basestring = basestring + try: from subprocess import CalledProcessError except ImportError: