Change the treatment of positions returned by PEP293

error handers in the Unicode codecs: Negative
positions are treated as being relative to the end of
the input and out of bounds positions result in an
IndexError.

Also update the PEP and include an explanation of
this in the documentation for codecs.register_error.

Fixes a small bug in iconv_codecs: if the position
from the callback is negative *add* it to the size
instead of substracting it.

From SF patch #677429.
This commit is contained in:
Walter Dörwald 2003-01-31 17:19:08 +00:00
parent f7f4517fae
commit 2e0b18af30
5 changed files with 122 additions and 41 deletions

View file

@ -572,7 +572,7 @@ class C:
\var{classinfo} argument, or of a (direct or indirect) subclass
thereof. Also return true if \var{classinfo} is a type object and
\var{object} is an object of that type. If \var{object} is not a
class instance or a object of the given type, the function always
class instance or an object of the given type, the function always
returns false. If \var{classinfo} is neither a class object nor a
type object, it may be a tuple of class or type objects, or may
recursively contain other such tuples (other sequence types are not