mirror of
https://github.com/python/cpython.git
synced 2025-12-08 06:10:17 +00:00
Raise valueerrors
This commit is contained in:
parent
609d5adc7c
commit
cb8197ad6d
8 changed files with 52 additions and 16 deletions
|
|
@ -14,7 +14,8 @@
|
|||
### Codec APIs
|
||||
|
||||
def uu_encode(input, errors='strict', filename='<data>', mode=0o666):
|
||||
assert errors == 'strict'
|
||||
if errors != 'strict':
|
||||
raise ValueError(f'Unsupported error handling mode: "{errors}" - must be "strict"')
|
||||
infile = BytesIO(input)
|
||||
outfile = BytesIO()
|
||||
read = infile.read
|
||||
|
|
@ -35,7 +36,8 @@ def uu_encode(input, errors='strict', filename='<data>', mode=0o666):
|
|||
return (outfile.getvalue(), len(input))
|
||||
|
||||
def uu_decode(input, errors='strict'):
|
||||
assert errors == 'strict'
|
||||
if errors != 'strict':
|
||||
raise ValueError(f'Unsupported error handling mode: "{errors}" - must be "strict"')
|
||||
infile = BytesIO(input)
|
||||
outfile = BytesIO()
|
||||
readline = infile.readline
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue