bpo-40998: Address compiler warnings found by ubsan (GH-20929)
Signed-off-by: Christian Heimes <christian@python.org>
Automerge-Triggered-By: GH:tiran
diff --git a/Parser/string_parser.c b/Parser/string_parser.c
index 1285968..8f6433d 100644
--- a/Parser/string_parser.c
+++ b/Parser/string_parser.c
@@ -69,6 +69,9 @@ decode_unicode_with_escapes(Parser *parser, const char *s, size_t len, Token *t)
return NULL;
}
p = buf = PyBytes_AsString(u);
+ if (p == NULL) {
+ return NULL;
+ }
end = s + len;
while (s < end) {
if (*s == '\\') {