Issue #16975: Fix error handling bug in the escape-decode decoder.
diff --git a/Objects/stringobject.c b/Objects/stringobject.c
index b9809a2..0664142 100644
--- a/Objects/stringobject.c
+++ b/Objects/stringobject.c
@@ -726,6 +726,10 @@
                              errors);
                 goto failed;
             }
+            /* skip \x */
+            if (s < end && isxdigit(Py_CHARMASK(s[0])))
+                s++; /* and a hexdigit */
+            break;
 #ifndef Py_USING_UNICODE
         case 'u':
         case 'U':