[New-bugs-announce] [issue39351] Remove base64.encodestring() and base64.decodestring() aliases, deprecated since Python 3.1

STINNER Victor report at bugs.python.org
Thu Jan 16 03:25:17 EST 2020


New submission from STINNER Victor <vstinner at python.org>:

base64.encodestring() and base64.decodestring() are aliases deprecated since Python 3.1: encodebytes() and decodebytes() should be used instead.

In Python 3, "string" means Unicode, whereas these functions really work at the bytes level:

>>> base64.encodestring("text")
TypeError: expected bytes-like object, not str

>>> base64.decodestring("text")
TypeError: expected bytes-like object, not str

encodebytes() and decodebytes() names are explicit on the expected types (bytes or bytes-like).

This issue is similar to bpo-38916: "Remove array.fromstring() and array.tostring() aliases, deprecated since Python 3.2".

Attached PR removes the deprecated aliases base64.encodestring() and base64.decodestring().

----------
components: Library (Lib)
messages: 360096
nosy: vstinner
priority: normal
severity: normal
status: open
title: Remove base64.encodestring() and base64.decodestring() aliases, deprecated since Python 3.1
versions: Python 3.9

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue39351>
_______________________________________


More information about the New-bugs-announce mailing list