Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 6f51141

Browse files
authored
Merge pull request python#59 from sunmy2019/fix-the-wrong-return-value
2 parents 3ed61b4 + 17bfaec commit 6f51141

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

Parser/string_parser.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -214,19 +214,19 @@ _PyPegen_parse_string(Parser *p, Token *t)
214214

215215
if (quote != '\'' && quote != '\"') {
216216
PyErr_BadInternalCall();
217-
return -1;
217+
return NULL;
218218
}
219219
/* Skip the leading quote char. */
220220
s++;
221221
len = strlen(s);
222222
if (len > INT_MAX) {
223223
PyErr_SetString(PyExc_OverflowError, "string to parse is too long");
224-
return -1;
224+
return NULL;
225225
}
226226
if (s[--len] != quote) {
227227
/* Last quote char must match the first. */
228228
PyErr_BadInternalCall();
229-
return -1;
229+
return NULL;
230230
}
231231
if (len >= 4 && s[0] == quote && s[1] == quote) {
232232
/* A triple quoted string. We've already skipped one quote at
@@ -237,7 +237,7 @@ _PyPegen_parse_string(Parser *p, Token *t)
237237
/* And check that the last two match. */
238238
if (s[--len] != quote || s[--len] != quote) {
239239
PyErr_BadInternalCall();
240-
return -1;
240+
return NULL;
241241
}
242242
}
243243

@@ -251,7 +251,7 @@ _PyPegen_parse_string(Parser *p, Token *t)
251251
RAISE_SYNTAX_ERROR(
252252
"bytes can only contain ASCII "
253253
"literal characters");
254-
return -1;
254+
return NULL;
255255
}
256256
}
257257
if (rawmode) {

0 commit comments

Comments
 (0)