Pablo Galindo Salgado <[email protected]> added the comment:
Ok, I have investigated more and it seems that XLC is miscompiling the keyword
list. For instance, if you add:
index 9d3ac575df..70d431e6be 100644
--- a/Parser/pegen/parse.c
+++ b/Parser/pegen/parse.c
@@ -1,6 +1,6 @@
-// @generated by pegen.py from ./Grammar/python.gram
#include "pegen.h"
+// @generated by pegen.py from ./Grammar/python.gram
#if defined(Py_DEBUG) && defined(Py_BUILD_CORE)
extern int Py_DebugFlag;
#define D(x) if (Py_DebugFlag) x;
@@ -24735,7 +24735,12 @@ _PyPegen_parse(Parser *p)
// Initialize keywords
p->keywords = reserved_keywords;
p->n_keyword_lists = n_keyword_lists;
-
+ for (int s=0; s<p->n_keyword_lists;s++) {
+ KeywordToken *kk = p->keywords[s];
+ if (kk) {
+ printf("--> %i %.*s\n", s,s, kk->str);
+ }
+ }
// Run parser
void *result = NULL;
if (p->start_rule == Py_file_input) {
Before crashing, this will print the following:
--> 2 if
--> 3 del
--> 4 pass
--> 5 raise
--> 6 return
--> 7 finally
--> 8
--> 14 __peg_parser__
Segmentation fault (core dumped)
Notice that the entry for size 8 is missing. I don't understand why is missing
because the data is static and there is an entry there:
static KeywordToken *reserved_keywords[] = {
NULL,
NULL,
(KeywordToken[]) {
{"if", 510},
{"in", 518},
{"as", 520},
{"is", 527},
{"or", 532},
{NULL, -1},
},
(KeywordToken[]) {
{"del", 503},
{"try", 511},
{"for", 517},
{"def", 523},
{"not", 526},
{"and", 533},
{NULL, -1},
},
(KeywordToken[]) {
{"pass", 502},
{"from", 514},
{"elif", 515},
{"else", 516},
{"with", 519},
{"True", 528},
{"None", 530},
{NULL, -1},
},
(KeywordToken[]) {
{"raise", 501},
{"yield", 504},
{"break", 506},
{"while", 512},
{"class", 524},
{"False", 529},
{NULL, -1},
},
(KeywordToken[]) {
{"return", 500},
{"assert", 505},
{"global", 508},
{"import", 513},
{"except", 521},
{"lambda", 525},
{NULL, -1},
},
(KeywordToken[]) {
{"finally", 522},
{NULL, -1},
},
(KeywordToken[]) {
{"continue", 507},
{"nonlocal", 509},
{NULL, -1},
},
NULL,
NULL,
NULL,
NULL,
NULL,
(KeywordToken[]) {
{"__peg_parser__", 531},
{NULL, -1},
},
};
----------
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue41215>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com