Skip to content

Commit 6cb2b5b

Browse files
committed
Issue #17827: Document codecs.encode and codecs.decode
1 parent aeaecfd commit 6cb2b5b

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed

Doc/library/codecs.rst

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,25 @@ manages the codec and error handling lookup process.
2222

2323
It defines the following functions:
2424

25+
.. function:: encode(obj, encoding='utf-8', errors='strict')
26+
27+
Encodes *obj* using the codec registered for *encoding*.
28+
29+
*Errors* may be given to set the desired error handling scheme. The
30+
default error handler is ``strict`` meaning that encoding errors raise
31+
:exc:`ValueError` (or a more codec specific subclass, such as
32+
:exc:`UnicodeEncodeError`). Refer to :ref:`codec-base-classes` for more
33+
information on codec error handling.
34+
35+
.. function:: decode(obj, encoding='utf-8', errors='strict')
36+
37+
Decodes *obj* using the codec registered for *encoding*.
38+
39+
*Errors* may be given to set the desired error handling scheme. The
40+
default error handler is ``strict`` meaning that decoding errors raise
41+
:exc:`ValueError` (or a more codec specific subclass, such as
42+
:exc:`UnicodeDecodeError`). Refer to :ref:`codec-base-classes` for more
43+
information on codec error handling.
2544

2645
.. function:: register(search_function)
2746

Misc/NEWS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,9 @@ Core and Builtins
7676
Library
7777
-------
7878

79+
- Issue #17827: Add the missing documentation for ``codecs.encode`` and
80+
``codecs.decode``.
81+
7982
- Issue #18458: Prevent crashes with newer versions of libedit. Its readline
8083
emulation has changed from 0-based indexing to 1-based like gnu readline.
8184
Original patch by Ronald Oussoren.

0 commit comments

Comments
 (0)