diff options
author | Christian Heimes <christian@cheimes.de> | 2013-07-22 08:30:45 (GMT) |
---|---|---|
committer | Christian Heimes <christian@cheimes.de> | 2013-07-22 08:30:45 (GMT) |
commit | 826b754e3249a82b2d33208a907ae0340390e450 (patch) | |
tree | d592f51805587a9a9cd023a226948a2e8bdbe204 /Parser | |
parent | 3a8573230c0d5b42e3f66ea604fdb86cafeb6366 (diff) | |
parent | 53d2dc4045f6793d166b2806d7726c45cdea74e4 (diff) | |
download | cpython-826b754e3249a82b2d33208a907ae0340390e450.zip cpython-826b754e3249a82b2d33208a907ae0340390e450.tar.gz cpython-826b754e3249a82b2d33208a907ae0340390e450.tar.bz2 |
Add sanity check to PyGrammar_LabelRepr() in order to catch invalid tokens when debugging
a new grammar.
CID 715360
Diffstat (limited to 'Parser')
-rw-r--r-- | Parser/grammar1.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/Parser/grammar1.c b/Parser/grammar1.c index 4b5aa8a..0952796 100644 --- a/Parser/grammar1.c +++ b/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"); + } } |