mirror of
https://github.com/python/cpython.git
synced 2025-12-31 04:23:37 +00:00
gh-111178: Skip undefined behavior checks in _PyPegen_lookahead() (#131714)
For example, expression_rule() return type is 'expr_ty', whereas _PyPegen_lookahead() uses 'void*'.
This commit is contained in:
parent
9ef9d687ff
commit
3796884528
1 changed files with 5 additions and 2 deletions
|
|
@ -406,11 +406,14 @@ _PyPegen_lookahead_with_int(int positive, Token *(func)(Parser *, int), Parser *
|
|||
return (res != NULL) == positive;
|
||||
}
|
||||
|
||||
int
|
||||
// gh-111178: Use _Py_NO_SANITIZE_UNDEFINED to disable sanitizer checks on
|
||||
// undefined behavior (UBsan) in this function, rather than changing 'func'
|
||||
// callback API.
|
||||
int _Py_NO_SANITIZE_UNDEFINED
|
||||
_PyPegen_lookahead(int positive, void *(func)(Parser *), Parser *p)
|
||||
{
|
||||
int mark = p->mark;
|
||||
void *res = (void*)func(p);
|
||||
void *res = func(p);
|
||||
p->mark = mark;
|
||||
return (res != NULL) == positive;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue