Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 0 additions & 12 deletions Doc/library/base64.rst
Original file line number Diff line number Diff line change
Expand Up @@ -235,12 +235,6 @@ The legacy interface:

.. versionadded:: 3.1

.. function:: decodestring(s)

Deprecated alias of :func:`decodebytes`.

.. deprecated:: 3.1


.. function:: encode(input, output)

Expand All @@ -261,12 +255,6 @@ The legacy interface:

.. versionadded:: 3.1

.. function:: encodestring(s)

Deprecated alias of :func:`encodebytes`.

.. deprecated:: 3.1


An example usage of the module:

Expand Down
5 changes: 5 additions & 0 deletions Doc/whatsnew/3.9.rst
Original file line number Diff line number Diff line change
Expand Up @@ -411,6 +411,11 @@ Removed
of :pep:`442`. Patch by Joannah Nanjekye.
(Contributed by Joannah Nanjekye in :issue:`15088`)

* ``base64.encodestring()`` and ``base64.decodestring()``, aliases deprecated
since Python 3.1, have been removed: use :func:`base64.encodebytes` and
:func:`base64.decodebytes` instead.
(Contributed by Victor Stinner in :issue:`39351`.)


Porting to Python 3.9
=====================
Expand Down
16 changes: 0 additions & 16 deletions Lib/base64.py
Original file line number Diff line number Diff line change
Expand Up @@ -531,28 +531,12 @@ def encodebytes(s):
pieces.append(binascii.b2a_base64(chunk))
return b"".join(pieces)

def encodestring(s):
"""Legacy alias of encodebytes()."""
import warnings
warnings.warn("encodestring() is a deprecated alias since 3.1, "
"use encodebytes()",
DeprecationWarning, 2)
return encodebytes(s)


def decodebytes(s):
"""Decode a bytestring of base-64 data into a bytes object."""
_input_type_check(s)
return binascii.a2b_base64(s)

def decodestring(s):
"""Legacy alias of decodebytes()."""
import warnings
warnings.warn("decodestring() is a deprecated alias since Python 3.1, "
"use decodebytes()",
DeprecationWarning, 2)
return decodebytes(s)


# Usable as a script...
def main():
Expand Down
8 changes: 0 additions & 8 deletions Lib/test/test_base64.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,6 @@ def check_type_errors(self, f):
int_data = memoryview(b"1234").cast('I')
self.assertRaises(TypeError, f, int_data)

def test_encodestring_warns(self):
with self.assertWarns(DeprecationWarning):
base64.encodestring(b"www.python.org")

def test_decodestring_warns(self):
with self.assertWarns(DeprecationWarning):
base64.decodestring(b"d3d3LnB5dGhvbi5vcmc=\n")

def test_encodebytes(self):
eq = self.assertEqual
eq(base64.encodebytes(b"www.python.org"), b"d3d3LnB5dGhvbi5vcmc=\n")
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Remove ``base64.encodestring()`` and ``base64.decodestring()``, aliases
deprecated since Python 3.1: use :func:`base64.encodebytes` and
:func:`base64.decodebytes` instead.