Issue #4770: Restrict binascii module to accept only bytes (as specified).
And fix the email package to encode to ASCII instead of ``raw-unicode-escape`` before ASCII-to-binary decoding.
diff --git a/Doc/library/binascii.rst b/Doc/library/binascii.rst
index 2f7851a..a34c843 100644
--- a/Doc/library/binascii.rst
+++ b/Doc/library/binascii.rst
@@ -18,6 +18,11 @@
low-level functions written in C for greater speed that are used by the
higher-level modules.
+.. note::
+
+ Encoding and decoding functions do not accept Unicode strings. Only bytestring
+ and bytearray objects can be processed.
+
The :mod:`binascii` module defines the following functions:
@@ -54,6 +59,9 @@
data. More than one line may be passed at a time. If the optional argument
*header* is present and true, underscores will be decoded as spaces.
+ .. versionchanged:: 3.2
+ accept only bytestring or bytearray object as input.
+
.. function:: b2a_qp(data, quotetabs=False, istext=True, header=False)
@@ -83,6 +91,9 @@
decompressed data, unless data input data ends in an orphaned repeat indicator,
in which case the :exc:`Incomplete` exception is raised.
+ .. versionchanged:: 3.2
+ accept only bytestring or bytearray object as input.
+
.. function:: rlecode_hqx(data)
@@ -139,6 +150,9 @@
of hexadecimal digits (which can be upper or lower case), otherwise a
:exc:`TypeError` is raised.
+ .. versionchanged:: 3.2
+ accept only bytestring or bytearray object as input.
+
.. exception:: Error
@@ -164,4 +178,3 @@
Module :mod:`quopri`
Support for quoted-printable encoding used in MIME email messages.
-