diff options
| author | Serhiy Storchaka <storchaka@gmail.com> | 2013-02-10 17:43:25 +0200 |
|---|---|---|
| committer | Serhiy Storchaka <storchaka@gmail.com> | 2013-02-10 17:43:25 +0200 |
| commit | b8cbba5877df478966092ce069b6cedea8487c53 (patch) | |
| tree | de7fcae85c654a604265ef9f73e50c6583ad05b1 /Objects/bytesobject.c | |
| parent | 419d9a83d5688940b3dbb410029080ad7f2f71a8 (diff) | |
| parent | 801d955f04d46994ac5bc7270fea86a7703c5192 (diff) | |
| download | cpython-git-b8cbba5877df478966092ce069b6cedea8487c53.tar.gz | |
Issue #12983: Bytes literals with invalid \x escape now raise a SyntaxError
and a full traceback including line number.
Diffstat (limited to 'Objects/bytesobject.c')
| -rw-r--r-- | Objects/bytesobject.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/Objects/bytesobject.c b/Objects/bytesobject.c index ba1fefd897..056ac3689f 100644 --- a/Objects/bytesobject.c +++ b/Objects/bytesobject.c @@ -474,8 +474,9 @@ PyObject *PyBytes_DecodeEscape(const char *s, break; } if (!errors || strcmp(errors, "strict") == 0) { - PyErr_SetString(PyExc_ValueError, - "invalid \\x escape"); + PyErr_Format(PyExc_ValueError, + "invalid \\x escape at position %d", + s - 2 - (end - len)); goto failed; } if (strcmp(errors, "replace") == 0) { |
