mirror of
https://github.com/python/cpython.git
synced 2024-11-24 18:34:43 +08:00
bpo-45820: Fix a segfault when the parser fails without reading any input (GH-29580)
This commit is contained in:
parent
9d6215a54c
commit
df4ae55e66
@ -0,0 +1,2 @@
|
||||
Fix a segfault when the parser fails without reading any input. Patch by
|
||||
Pablo Galindo
|
@ -368,6 +368,14 @@ tokenizer_error(Parser *p)
|
||||
void *
|
||||
_PyPegen_raise_error(Parser *p, PyObject *errtype, const char *errmsg, ...)
|
||||
{
|
||||
if (p->fill == 0) {
|
||||
va_list va;
|
||||
va_start(va, errmsg);
|
||||
_PyPegen_raise_error_known_location(p, errtype, 0, 0, 0, -1, errmsg, va);
|
||||
va_end(va);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
Token *t = p->known_err_token != NULL ? p->known_err_token : p->tokens[p->fill - 1];
|
||||
Py_ssize_t col_offset;
|
||||
Py_ssize_t end_col_offset = -1;
|
||||
|
Loading…
Reference in New Issue
Block a user