[PATCH 5 of 5 stable] py3: ignore warning about deprecated `base64.encodestring()`

Yuya Nishihara yuya at tcha.org
Tue Jun 16 09:47:07 UTC 2020


On Tue, 16 Jun 2020 03:50:30 +0200, Manuel Jacob wrote:
> # HG changeset patch
> # User Manuel Jacob <me at manueljacob.de>
> # Date 1592185813 -7200
> #      Mon Jun 15 03:50:13 2020 +0200
> # Branch stable
> # Node ID 4771e5ae53c4d6fe4c4cc66497930f06c16e6179
> # Parent  f86ca8753fb2a1c15c8abda7991181e09ad36071
> # EXP-Topic convert-svn
> py3: ignore warning about deprecated `base64.encodestring()`
> 
> It fixes the following warning:
> hgext/convert/common.py:89: DeprecationWarning: encodestring() is a deprecated alias since 3.1, use encodebytes()
>   lines = base64.encodestring(s)
> 
> `base64.encodebytes()` doesn’t exist on Python 2. Therefore, we continue to use
> `base64.encodestring()`.
> 
> An alternative way to get rid of this warning would have been to call
> `base64.encodebytes()` if available, and `base64.encodestring()` otherwise.

I prefer using `if py3` switch than suppressing the warning.



More information about the Mercurial-devel mailing list