From: Nick Coghlan Date: Sun, 13 Oct 2013 14:22:13 +0000 (+1000) Subject: Issue #17827: Document codecs.encode and codecs.decode X-Git-Tag: v3.4.0a4~130^2^2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=6cb2b5b1e1ded4c10e305e493e016a7ccf0275cd;p=thirdparty%2FPython%2Fcpython.git Issue #17827: Document codecs.encode and codecs.decode --- diff --git a/Doc/library/codecs.rst b/Doc/library/codecs.rst index a5a27a2159d9..004f5c784c6d 100644 --- a/Doc/library/codecs.rst +++ b/Doc/library/codecs.rst @@ -22,6 +22,25 @@ manages the codec and error handling lookup process. It defines the following functions: +.. function:: encode(obj, encoding='utf-8', errors='strict') + + Encodes *obj* using the codec registered for *encoding*. + + *Errors* may be given to set the desired error handling scheme. The + default error handler is ``strict`` meaning that encoding errors raise + :exc:`ValueError` (or a more codec specific subclass, such as + :exc:`UnicodeEncodeError`). Refer to :ref:`codec-base-classes` for more + information on codec error handling. + +.. function:: decode(obj, encoding='utf-8', errors='strict') + + Decodes *obj* using the codec registered for *encoding*. + + *Errors* may be given to set the desired error handling scheme. The + default error handler is ``strict`` meaning that decoding errors raise + :exc:`ValueError` (or a more codec specific subclass, such as + :exc:`UnicodeDecodeError`). Refer to :ref:`codec-base-classes` for more + information on codec error handling. .. function:: register(search_function) diff --git a/Misc/NEWS b/Misc/NEWS index 536ea0eec9b5..e764376a552e 100644 --- a/Misc/NEWS +++ b/Misc/NEWS @@ -76,6 +76,9 @@ Core and Builtins Library ------- +- Issue #17827: Add the missing documentation for ``codecs.encode`` and + ``codecs.decode``. + - Issue #18458: Prevent crashes with newer versions of libedit. Its readline emulation has changed from 0-based indexing to 1-based like gnu readline. Original patch by Ronald Oussoren.