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
|
|
@ -11,11 +11,13 @@
|
|||
### Codec APIs
|
||||
|
||||
def base64_encode(input, errors='strict'):
|
||||
assert errors == 'strict'
|
||||
if errors != 'strict':
|
||||
raise ValueError(f'Unsupported error handling mode: "{errors}" - must be "strict"')
|
||||
return (base64.encodebytes(input), len(input))
|
||||
|
||||
def base64_decode(input, errors='strict'):
|
||||
assert errors == 'strict'
|
||||
if errors != 'strict':
|
||||
raise ValueError(f'Unsupported error handling mode: "{errors}" - must be "strict"')
|
||||
return (base64.decodebytes(input), len(input))
|
||||
|
||||
class Codec(codecs.Codec):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue