diff options
author | Martin v. Löwis <martin@v.loewis.de> | 2005-08-24 07:38:12 (GMT) |
---|---|---|
committer | Martin v. Löwis <martin@v.loewis.de> | 2005-08-24 07:38:12 (GMT) |
commit | 56066d2e554b6b92375d3e276f2f02663526c087 (patch) | |
tree | 877e93e7f59a7f09a713c029d8b2227f61b8521d /Doc | |
parent | 6d2b346140ed0f3bc4c67fc33bf69a60c496e6a4 (diff) | |
download | cpython-56066d2e554b6b92375d3e276f2f02663526c087.zip cpython-56066d2e554b6b92375d3e276f2f02663526c087.tar.gz cpython-56066d2e554b6b92375d3e276f2f02663526c087.tar.bz2 |
Return complete lines from codec stream readers
even if there is an exception in later lines, resulting in
correct line numbers for decoding errors in source code. Fixes #1178484.
Will backport to 2.4.
Diffstat (limited to 'Doc')
-rw-r--r-- | Doc/lib/libcodecs.tex | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/Doc/lib/libcodecs.tex b/Doc/lib/libcodecs.tex index d98f474..7e22386 100644 --- a/Doc/lib/libcodecs.tex +++ b/Doc/lib/libcodecs.tex @@ -394,7 +394,7 @@ order to be compatible to the Python codec registry. be extended with \function{register_error()}. \end{classdesc} -\begin{methoddesc}{read}{\optional{size\optional{, chars}}} +\begin{methoddesc}{read}{\optional{size\optional{, chars, \optional{firstline}}}} Decodes data from the stream and returns the resulting object. \var{chars} indicates the number of characters to read from the @@ -408,12 +408,16 @@ order to be compatible to the Python codec registry. decode as much as possible. \var{size} is intended to prevent having to decode huge files in one step. + \var{firstline} indicates that it would be sufficient to only return + the first line, if there are decoding errors on later lines. + The method should use a greedy read strategy meaning that it should read as much data as is allowed within the definition of the encoding and the given size, e.g. if optional encoding endings or state markers are available on the stream, these should be read too. \versionchanged[\var{chars} argument added]{2.4} + \versionchanged[\var{firstline} argument added]{2.4.2} \end{methoddesc} \begin{methoddesc}{readline}{\optional{size\optional{, keepends}}} |