[Python-checkins] cpython (merge 3.3 -> default): Add sanity check to PyGrammar_LabelRepr() in order to catch invalid tokens when
christian.heimes
python-checkins at python.org
Mon Jul 22 10:38:17 CEST 2013
http://hg.python.org/cpython/rev/4f47dd0625bf
changeset: 84782:4f47dd0625bf
parent: 84780:020dbfdf9517
parent: 84781:03b937e5b19f
user: Christian Heimes <christian at cheimes.de>
date: Mon Jul 22 10:30:45 2013 +0200
summary:
Add sanity check to PyGrammar_LabelRepr() in order to catch invalid tokens when debugging
a new grammar.
CID 715360
files:
Parser/grammar1.c | 5 ++++-
1 files changed, 4 insertions(+), 1 deletions(-)
diff --git a/Parser/grammar1.c b/Parser/grammar1.c
--- a/Parser/grammar1.c
+++ b/Parser/grammar1.c
@@ -45,7 +45,7 @@
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 @@
return buf;
}
}
+ else {
+ Py_FatalError("invalid label");
+ }
}
--
Repository URL: http://hg.python.org/cpython
More information about the Python-checkins
mailing list