[issue37377] unicode error should raise a value error

2019-06-23 Thread hai shi
hai shi added the comment: Got it, thank for your detailed explanation, steven. -- stage: -> resolved status: open -> closed ___ Python tracker ___

[issue37377] unicode error should raise a value error

2019-06-23 Thread Steven D'Aprano
Steven D'Aprano added the comment: It is a *syntax* error. You have written bad syntax, just as the error message says. Your \xXX code is too short, only 1 hex digit instead of 2. I disagree that this should be a value error: it isn't a bad value, it is bad syntax. I don't know what the

[issue37377] unicode error should raise a value error

2019-06-23 Thread hai shi
New submission from hai shi : >>> "\x1" File "", 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: