Commit 07b16159 authored by Victor Stinner's avatar Victor Stinner

Issue #21488: Fix doc of codecs.decode() and codecs.encode(), no keyword support.

Patch written by Brad Aylsworth.
parent 0eb9ee97
...@@ -23,24 +23,26 @@ manages the codec and error handling lookup process. ...@@ -23,24 +23,26 @@ manages the codec and error handling lookup process.
It defines the following functions: It defines the following functions:
.. function:: encode(obj, encoding='ascii', errors='strict') .. function:: encode(obj, [encoding[, errors]])
Encodes *obj* using the codec registered for *encoding*. Encodes *obj* using the codec registered for *encoding*. The default
encoding is ``'ascii'``.
*Errors* may be given to set the desired error handling scheme. The *Errors* may be given to set the desired error handling scheme. The
default error handler is ``strict`` meaning that encoding errors raise default error handler is ``'strict'`` meaning that encoding errors raise
:exc:`ValueError` (or a more codec specific subclass, such as :exc:`ValueError` (or a more codec specific subclass, such as
:exc:`UnicodeEncodeError`). Refer to :ref:`codec-base-classes` for more :exc:`UnicodeEncodeError`). Refer to :ref:`codec-base-classes` for more
information on codec error handling. information on codec error handling.
.. versionadded:: 2.4 .. versionadded:: 2.4
.. function:: decode(obj, encoding='ascii', errors='strict') .. function:: decode(obj, [encoding[, errors]])
Decodes *obj* using the codec registered for *encoding*. Decodes *obj* using the codec registered for *encoding*. The default
encoding is ``'ascii'``.
*Errors* may be given to set the desired error handling scheme. The *Errors* may be given to set the desired error handling scheme. The
default error handler is ``strict`` meaning that decoding errors raise default error handler is ``'strict'`` meaning that decoding errors raise
:exc:`ValueError` (or a more codec specific subclass, such as :exc:`ValueError` (or a more codec specific subclass, such as
:exc:`UnicodeDecodeError`). Refer to :ref:`codec-base-classes` for more :exc:`UnicodeDecodeError`). Refer to :ref:`codec-base-classes` for more
information on codec error handling. information on codec error handling.
......
...@@ -56,6 +56,7 @@ David Ascher ...@@ -56,6 +56,7 @@ David Ascher
Chris AtLee Chris AtLee
Aymeric Augustin Aymeric Augustin
John Aycock John Aycock
Brad Aylsworth
Donovan Baarda Donovan Baarda
Arne Babenhauserheide Arne Babenhauserheide
Attila Babo Attila Babo
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment