[issue41215] AIX: build fails for xlc/xlC since new PEG parser

Pablo Galindo Salgado report at bugs.python.org
Sun Jul 5 14:34:37 EDT 2020


Pablo Galindo Salgado <pablogsal at gmail.com> added the comment:

Michael, can you try with this patch:

diff --git a/Parser/pegen.c b/Parser/pegen.c
index 53e3d49138..7faeec26ad 100644
--- a/Parser/pegen.c
+++ b/Parser/pegen.c
@@ -528,7 +528,7 @@ _get_keyword_or_name_type(Parser *p, const char *name, int name_len)
     if (name_len >= p->n_keyword_lists || p->keywords[name_len] == NULL) {
         return NAME;
     }
-    for (KeywordToken *k = p->keywords[name_len]; k->type != -1; k++) {
+    for (KeywordToken *k = p->keywords[name_len]; k != NULL && k->type != -1; k++) {
         if (strncmp(k->str, name, name_len) == 0) {
             return k->type;
         }


For whatever reasons, it seems that me are calling into _get_keyword_or_name_type with a name_len of 0.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue41215>
_______________________________________


More information about the Python-bugs-list mailing list