]> granicus.if.org Git - python/commitdiff
Close #17827: Document codecs.encode & codecs.decode
authorNick Coghlan <ncoghlan@gmail.com>
Mon, 4 Nov 2013 10:05:16 +0000 (20:05 +1000)
committerNick Coghlan <ncoghlan@gmail.com>
Mon, 4 Nov 2013 10:05:16 +0000 (20:05 +1000)
Doc/library/codecs.rst
Misc/NEWS

index 829be68155158bfd7173cc5a53b1bbb035d5e077..f0e179b65b96d613e6f935c2ad1176a26c7cb956 100644 (file)
@@ -23,6 +23,29 @@ manages the codec and error handling lookup process.
 
 It defines the following functions:
 
+.. function:: encode(obj, encoding='ascii', 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.
+
+   .. versionadded:: 2.4
+
+.. function:: decode(obj, encoding='ascii', 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.
+
+   .. versionadded:: 2.4
 
 .. function:: register(search_function)
 
index 9de6aafbb5c1359c97e6402cd6c7087bc0c593ef..98efc56027e062f773879e9a3cb30de580306804 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -12,9 +12,13 @@ Core and Builtins
 Library
 -------
 
+- Issue #17827: Add the missing documentation for ``codecs.encode`` and
+    ``codecs.decode``.
+
 - Issue #6157: Fixed Tkinter.Text.debug().  Original patch by Guilherme Polo.
 
 - Issue #6160: The bbox() method of tkinter.Spinbox now returns a tuple of
+
   integers instead of a string.  Based on patch by Guilherme Polo.
 
 - Issue #19286: Directories in ``package_data`` are no longer added to