mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
Raise statement normalization in Lib/.
This commit is contained in:
parent
8b3febef2f
commit
ce36ad8a46
80 changed files with 502 additions and 530 deletions
|
@ -135,7 +135,7 @@ def decode_generalized_number(extended, extpos, bias, errors):
|
|||
char = ord(extended[extpos])
|
||||
except IndexError:
|
||||
if errors == "strict":
|
||||
raise UnicodeError, "incomplete punicode string"
|
||||
raise UnicodeError("incomplete punicode string")
|
||||
return extpos + 1, None
|
||||
extpos += 1
|
||||
if 0x41 <= char <= 0x5A: # A-Z
|
||||
|
@ -172,7 +172,7 @@ def insertion_sort(base, extended, errors):
|
|||
char += pos // (len(base) + 1)
|
||||
if char > 0x10FFFF:
|
||||
if errors == "strict":
|
||||
raise UnicodeError, ("Invalid character U+%x" % char)
|
||||
raise UnicodeError("Invalid character U+%x" % char)
|
||||
char = ord('?')
|
||||
pos = pos % (len(base) + 1)
|
||||
base = base[:pos] + chr(char) + base[pos:]
|
||||
|
@ -202,7 +202,7 @@ class Codec(codecs.Codec):
|
|||
|
||||
def decode(self, input, errors='strict'):
|
||||
if errors not in ('strict', 'replace', 'ignore'):
|
||||
raise UnicodeError, "Unsupported error handling "+errors
|
||||
raise UnicodeError("Unsupported error handling "+errors)
|
||||
res = punycode_decode(input, errors)
|
||||
return res, len(input)
|
||||
|
||||
|
@ -213,7 +213,7 @@ class IncrementalEncoder(codecs.IncrementalEncoder):
|
|||
class IncrementalDecoder(codecs.IncrementalDecoder):
|
||||
def decode(self, input, final=False):
|
||||
if self.errors not in ('strict', 'replace', 'ignore'):
|
||||
raise UnicodeError, "Unsupported error handling "+self.errors
|
||||
raise UnicodeError("Unsupported error handling "+self.errors)
|
||||
return punycode_decode(input, self.errors)
|
||||
|
||||
class StreamWriter(Codec,codecs.StreamWriter):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue