Issue #12983: Bytes literals with invalid \x escape now raise a SyntaxError
and a full traceback including line number.
diff --git a/Objects/bytesobject.c b/Objects/bytesobject.c
index 5e17107..47898fe 100644
--- a/Objects/bytesobject.c
+++ b/Objects/bytesobject.c
@@ -465,8 +465,9 @@
                 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) {