Mercurial > hg
changeset 44967:de7bdb0e2a95 stable
py3: suppress DeprecationWarning about deprecated base64 module aliases
base64.encodestring() / base64.decodestring() were renamed to
base64.encodebytes() / base64.decodebytes() in Python 3. The old names still
worked, but raised a DeprecationWarning.
author | Manuel Jacob <me@manueljacob.de> |
---|---|
date | Tue, 16 Jun 2020 12:59:45 +0200 |
parents | 0c27d981131a |
children | 75b59d221aa3 |
files | hgext/convert/common.py |
diffstat | 1 files changed, 10 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/hgext/convert/common.py Mon Jun 15 03:38:02 2020 +0200 +++ b/hgext/convert/common.py Tue Jun 16 12:59:45 2020 +0200 @@ -84,9 +84,17 @@ return l +if pycompat.ispy3: + base64_encodebytes = base64.encodebytes + base64_decodebytes = base64.decodebytes +else: + base64_encodebytes = base64.encodestring + base64_decodebytes = base64.decodestring + + def encodeargs(args): def encodearg(s): - lines = base64.encodestring(s) + lines = base64_encodebytes(s) lines = [l.splitlines()[0] for l in pycompat.iterbytestr(lines)] return b''.join(lines) @@ -95,7 +103,7 @@ def decodeargs(s): - s = base64.decodestring(s) + s = base64_decodebytes(s) return pickle.loads(s)