Skip to content

bpo-40334: Improvements to error-handling code in the PEG parser #20003

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
May 17, 2020
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Merge branch 'master' into error-improvements
  • Loading branch information
lysnikolaou committed May 17, 2020
commit c840fcae78be4fe6315a1ce5a00e278b08da15a6
16 changes: 11 additions & 5 deletions Parser/pegen/parse.c
Original file line number Diff line number Diff line change
Expand Up @@ -17052,7 +17052,8 @@ _loop0_126_rule(Parser *p)
int _start_mark = p->mark;
void **_children = PyMem_Malloc(sizeof(void *));
if (!_children) {
PyErr_Format(PyExc_MemoryError, "Parser out of memory");
p->error_indicator = 1;
PyErr_NoMemory();
return NULL;
}
ssize_t _children_capacity = 1;
Expand All @@ -17066,11 +17067,15 @@ _loop0_126_rule(Parser *p)
_res = star_named_expressions_var;
if (_n == _children_capacity) {
_children_capacity *= 2;
_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
if (!_children) {
PyErr_Format(PyExc_MemoryError, "realloc None");
void **_new_children = PyMem_Realloc(_children, _children_capacity*sizeof(void *));
if (!_new_children) {
p->error_indicator = 1;
PyErr_NoMemory();
return NULL;
}
else {
_children = _new_children;
}
}
_children[_n++] = _res;
_mark = p->mark;
Expand All @@ -17079,8 +17084,9 @@ _loop0_126_rule(Parser *p)
}
asdl_seq *_seq = _Py_asdl_seq_new(_n, p->arena);
if (!_seq) {
PyErr_Format(PyExc_MemoryError, "asdl_seq_new _loop0_126");
PyMem_Free(_children);
p->error_indicator = 1;
PyErr_NoMemory();
return NULL;
}
for (int i = 0; i < _n; i++) asdl_seq_SET(_seq, i, _children[i]);
Expand Down
You are viewing a condensed version of this merge commit. You can view the full changes here.
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy