[Python-checkins] cpython (merge default -> default): Merge heads

serhiy.storchaka python-checkins at python.org
Sun Oct 13 17:14:22 CEST 2013


http://hg.python.org/cpython/rev/de98b760ca77
changeset:   86308:de98b760ca77
parent:      86306:fc418ecd8777
parent:      86304:32f3d6721c84
user:        Serhiy Storchaka <storchaka at gmail.com>
date:        Sun Oct 13 18:11:11 2013 +0300
summary:
  Merge heads

files:
  Doc/library/codecs.rst |  19 +++++++++++++++++++
  Doc/whatsnew/3.4.rst   |  13 +++++++++++++
  Misc/NEWS              |   3 +++
  3 files changed, 35 insertions(+), 0 deletions(-)


diff --git a/Doc/library/codecs.rst b/Doc/library/codecs.rst
--- a/Doc/library/codecs.rst
+++ b/Doc/library/codecs.rst
@@ -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 --git a/Doc/whatsnew/3.4.rst b/Doc/whatsnew/3.4.rst
--- a/Doc/whatsnew/3.4.rst
+++ b/Doc/whatsnew/3.4.rst
@@ -197,6 +197,19 @@
 plain tuple.  (Contributed by Claudiu Popa in :issue:`17818`.)
 
 
+codecs
+------
+
+The :meth:`codecs.encode` and :meth:`codecs.decode` convenience functions are
+now properly documented. These functions have existed in the :mod:`codecs`
+module since ~2004, but were previously only discoverable through runtime
+introspection.
+
+Unlike the convenience methods on :class:`str`, :class:`bytes` and
+:class:`bytearray`, these convenience functions support arbitrary codecs,
+rather than being limited to Unicode text encodings.
+
+
 colorsys
 --------
 
diff --git a/Misc/NEWS b/Misc/NEWS
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -42,6 +42,9 @@
 Library
 -------
 
+- Issue #17827: Add the missing documentation for ``codecs.encode`` and
+  ``codecs.decode``.
+
 - Issue #19218: Rename collections.abc to _collections_abc in order to
   speed up interpreter start.
 

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list