(original) (raw)

changeset: 86303:b607ce6c9ee6 branch: 3.3 parent: 86294:e08dea96b6e2 user: Nick Coghlan ncoghlan@gmail.com date: Mon Oct 14 00:22:13 2013 +1000 files: Doc/library/codecs.rst Misc/NEWS description: Issue #17827: Document codecs.encode and codecs.decode diff -r e08dea96b6e2 -r b607ce6c9ee6 Doc/library/codecs.rst --- a/Doc/library/codecs.rst Sun Oct 13 10:49:41 2013 +0200 +++ b/Doc/library/codecs.rst Mon Oct 14 00:22:13 2013 +1000 @@ -22,6 +22,25 @@ 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 -r e08dea96b6e2 -r b607ce6c9ee6 Misc/NEWS --- a/Misc/NEWS Sun Oct 13 10:49:41 2013 +0200 +++ b/Misc/NEWS Mon Oct 14 00:22:13 2013 +1000 @@ -76,6 +76,9 @@ 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. /ncoghlan@gmail.com