Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(44643)

Unified Diff: Doc/library/fileinput.rst

Issue 25788: fileinput.hook_encoded has no way to pass arguments to codecs
Patch Set: Created 3 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | Doc/whatsnew/3.6.rst » ('j') | Doc/whatsnew/3.6.rst » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
--- a/Doc/library/fileinput.rst Mon Feb 01 12:47:15 2016 +0100
+++ b/Doc/library/fileinput.rst Wed Apr 27 12:07:21 2016 -0400
@@ -188,10 +188,16 @@
Usage example: ``fi = fileinput.FileInput(openhook=fileinput.hook_compressed)``
-.. function:: hook_encoded(encoding)
+.. function:: hook_encoded(encoding, errors=None)
Returns a hook which opens each file with :func:`codecs.open`, using the given
- *encoding* to read the file.
+ *encoding* to read the file. *errors* is an optional string that specifies how
storchaka 2016/04/27 22:14:52 Line is too long. It is recommended to use two spa
+ encoding and decoding errors are to be handled--this cannot be used in binary
+ mode. A variety of standard error handlers are available (listed under
+ :ref:`error-handlers`).
Usage example: ``fi =
- fileinput.FileInput(openhook=fileinput.hook_encoded("iso-8859-1"))``
+ fileinput.FileInput(openhook=fileinput.hook_encoded("iso-8859-1", errors="replace"))``
storchaka 2016/04/27 22:14:52 Bad example. Decoding "iso-8859-1" never fails. Sh
+
+ .. versionchanged:: 3.6
+ Added the *errors* keyword argument.
storchaka 2016/04/27 22:14:52 Changed to "Added the optional *errors* parameter.
« no previous file with comments | « no previous file | Doc/whatsnew/3.6.rst » ('j') | Doc/whatsnew/3.6.rst » ('J')

RSS Feeds Recent Issues | This issue
This is Rietveld 894c83f36cb7+