aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/tools/python/src/Modules/parsermodule.c
diff options
context:
space:
mode:
authorshadchin <shadchin@yandex-team.com>2024-06-13 19:29:50 +0300
committershadchin <shadchin@yandex-team.com>2024-06-13 19:51:47 +0300
commit9051e2318afc1bfbd88a103f7392e622aa8c9527 (patch)
tree5c63ea23ebd5e7b7b9864903a9312aa853193ca5 /contrib/tools/python/src/Modules/parsermodule.c
parent224da250178b9250c7577a167d44f94f732d3627 (diff)
downloadydb-9051e2318afc1bfbd88a103f7392e622aa8c9527.tar.gz
Update Python from 2.7.16 to 2.7.18
2a151e9cf2ebdfa59d250c1bbb800e908703a6f0
Diffstat (limited to 'contrib/tools/python/src/Modules/parsermodule.c')
-rw-r--r--contrib/tools/python/src/Modules/parsermodule.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/contrib/tools/python/src/Modules/parsermodule.c b/contrib/tools/python/src/Modules/parsermodule.c
index fcc618d5d9..759f0ff4f6 100644
--- a/contrib/tools/python/src/Modules/parsermodule.c
+++ b/contrib/tools/python/src/Modules/parsermodule.c
@@ -1055,14 +1055,15 @@ validate_numnodes(node *n, int num, const char *const name)
static int
validate_terminal(node *terminal, int type, char *string)
{
- int res = (validate_ntype(terminal, type)
- && ((string == 0) || (strcmp(string, STR(terminal)) == 0)));
-
- if (!res && !PyErr_Occurred()) {
+ if (!validate_ntype(terminal, type)) {
+ return 0;
+ }
+ if (string != NULL && strcmp(string, STR(terminal)) != 0) {
PyErr_Format(parser_error,
"Illegal terminal: expected \"%s\"", string);
+ return 0;
}
- return (res);
+ return 1;
}