New submission from Ned Deily <n...@acm.org>:

In behavior carried over from Python 2 string literals, Python 3 byte string 
literals raise a less helpful ValueError exception when an invalid hex escape 
code is given:

    >>> x = b'\x0'
    ValueError: invalid \x escape

A string literal raises a SyntaxError and a full traceback including line 
number:

    >>> x = '\x0'
      File "<stdin>", line 1
    SyntaxError: (unicode error) 'unicodeescape' codec can't decode
     bytes in position 0-2: end of string in escape sequence

----------
components: Interpreter Core
messages: 144059
nosy: ned.deily
priority: normal
severity: normal
status: open
title: byte string literals with invalid hex escape codes raise ValueError 
instead of SyntaxError
type: behavior
versions: Python 3.2, Python 3.3

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue12983>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to