@@ -1443,26 +1443,10 @@ to :class:`bytes` mappings. They are not supported by :meth:`bytes.decode`
14431443| uu_codec | uu | Convert the operand using | |
14441444| | | uuencode. | |
14451445+----------------------+------------------+------------------------------+------------------------------+
1446- | escape_codec | escape | Encode and decode byte | :func: `codecs.escape_encode ` |
1447- | | | sequences using escape | / |
1448- | | | sequences, similar to | :func: `codecs.escape_decode ` |
1449- | | | :func: `repr ` of bytes. | |
1450- +----------------------+------------------+------------------------------+------------------------------+
14511446| zlib_codec | zip, zlib | Compress the operand using | :meth: `zlib.compress ` / |
14521447| | | gzip. | :meth: `zlib.decompress ` |
14531448+----------------------+------------------+------------------------------+------------------------------+
14541449
1455- .. function :: codecs.escape_encode(input, errors=None)
1456-
1457- Encode *input * using escape sequences. Similar to how :func: `repr ` on bytes
1458- produces escaped byte values. Returns a tuple of the encoded bytes and
1459- the length consumed.
1460-
1461- .. function :: codecs.escape_decode(input, errors=None)
1462-
1463- Decode *input * from escape sequences back to the original bytes.
1464- Returns a tuple of the decoded bytes and the length consumed.
1465-
14661450.. [#b64 ] In addition to :term: `bytes-like objects <bytes-like object> `,
14671451 ``'base64_codec' `` also accepts ASCII-only instances of :class: `str ` for
14681452 decoding
@@ -1474,6 +1458,36 @@ to :class:`bytes` mappings. They are not supported by :meth:`bytes.decode`
14741458 Restoration of the aliases for the binary transforms.
14751459
14761460
1461+ .. _standalone-codec-functions :
1462+
1463+ Standalone Codec Functions
1464+ ^^^^^^^^^^^^^^^^^^^^^^^^^^
1465+
1466+ The following functions provide encoding and decoding functionality similar to codecs,
1467+ but are not available as named codecs through :func: `codecs.encode ` or :func: `codecs.decode `.
1468+ They are used internally (for example, by :mod: `pickle `) and behave similarly to the
1469+ `string_escape ` codec that was removed in Python 3.
1470+
1471+ .. function :: codecs.escape_encode(input, errors=None)
1472+
1473+ Encode *input * using escape sequences. Similar to how :func: `repr ` on bytes
1474+ produces escaped byte values.
1475+
1476+ *input * must be a :class: `bytes ` object.
1477+
1478+ Returns a tuple ``(output, length) `` where *output * is a :class: `bytes `
1479+ object and *length * is the number of bytes consumed.
1480+
1481+ .. function :: codecs.escape_decode(input, errors=None)
1482+
1483+ Decode *input * from escape sequences back to the original bytes.
1484+
1485+ *input * must be a :term: `bytes-like object `.
1486+
1487+ Returns a tuple ``(output, length) `` where *output * is a :class: `bytes `
1488+ object and *length * is the number of bytes consumed.
1489+
1490+
14771491.. _text-transforms :
14781492
14791493Text Transforms
0 commit comments