[issue37377] unicode error should raise a value error

hai shi report at bugs.python.org
Sun Jun 23 09:29:20 EDT 2019


New submission from hai shi <shihai1991 at 126.com>:

>>> "\x1"
  File "<stdin>", line 1
SyntaxError: (unicode error) 'unicodeescape' codec can't decode bytes in position 0-2: truncated \xXX escape

I think rasing the valueError would be exact.(pep223 agree this behavior: https://www.python.org/dev/peps/pep-0223/#bdfl-pronouncements).

And I think the error type could be changed in:
https://github.com/python/cpython/blob/master/Python/ast.c#L682

----------
components: Interpreter Core
messages: 346321
nosy: shihai1991
priority: normal
severity: normal
status: open
title: unicode error should raise a value error
type: behavior

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


More information about the Python-bugs-list mailing list