Steven D'Aprano <steve+pyt...@pearwood.info> 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 context of the BDFL pronouncement in PEP 223 was, but I think it was decided later that Guido wrong because the error in Python 2.4 and 2.5 was UnicodeDecodeError and then changed to SyntaxError in 2.6 (probably to match Python 3, I guess). In Python 3, both unicode and bytes strings give a syntax error for this error. ---------- nosy: +steven.daprano versions: +Python 3.9 _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue37377> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com