Browse Source

Add sanity check to PyGrammar_LabelRepr() in order to catch invalid tokens when debugging

a new grammar.
CID 715360
pull/224/head
Christian Heimes 13 years ago
parent
commit
53d2dc4045
  1. 5
      Parser/grammar1.c

5
Parser/grammar1.c

@ -45,7 +45,7 @@ PyGrammar_LabelRepr(label *lb)
else
return lb->lb_str;
}
else {
else if (lb->lb_type < N_TOKENS) {
if (lb->lb_str == NULL)
return _PyParser_TokenNames[lb->lb_type];
else {
@ -54,4 +54,7 @@ PyGrammar_LabelRepr(label *lb)
return buf;
}
}
else {
Py_FatalError("invalid label");
}
}
Loading…
Cancel
Save