[New-bugs-announce] [issue41115] Codecs should raise precise UnicodeDecodeError or UnicodeEncodeError

Antoine Pitrou report at bugs.python.org
Thu Jun 25 08:49:30 EDT 2020


New submission from Antoine Pitrou <solipsis at pitrou.net>:

A number of codecs raise bare UnicodeError, rather than Unicode{Decode,Encode}Error. Example:

  File "/home/antoine/miniconda3/envs/pyarrow/lib/python3.7/encodings/utf_16.py", line 67, in _buffer_decode
    raise UnicodeError("UTF-16 stream does not start with BOM")

A more complete list can be found here:
https://gist.github.com/pitrou/60594b28d8e47edcdb97d9b15d5f9866

----------
components: Library (Lib)
keywords: easy
messages: 372367
nosy: benjamin.peterson, ezio.melotti, lemburg, pitrou, serhiy.storchaka, vstinner
priority: normal
severity: normal
stage: needs patch
status: open
title: Codecs should raise precise UnicodeDecodeError or UnicodeEncodeError
type: behavior
versions: Python 3.7, Python 3.8, Python 3.9

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue41115>
_______________________________________


More information about the New-bugs-announce mailing list