summaryrefslogtreecommitdiffstats
path: root/Parser/tokenizer.c
diff options
context:
space:
mode:
authorBenjamin Peterson <benjamin@python.org>2014-06-07 19:36:39 (GMT)
committerBenjamin Peterson <benjamin@python.org>2014-06-07 19:36:39 (GMT)
commit93e51aac540f0dbd795e709a6fad0b9a62a5ae73 (patch)
tree0643e0ae6b8cca600bca2368a16fc765a4dfebfb /Parser/tokenizer.c
parent4807dd0490d9ea85feb3c9d1f33b7e2927f14326 (diff)
downloadcpython-93e51aac540f0dbd795e709a6fad0b9a62a5ae73.zip
cpython-93e51aac540f0dbd795e709a6fad0b9a62a5ae73.tar.gz
cpython-93e51aac540f0dbd795e709a6fad0b9a62a5ae73.tar.bz2
allow the keyword else immediately after (no space) an integer (closes #21642)
Diffstat (limited to 'Parser/tokenizer.c')
-rw-r--r--Parser/tokenizer.c19
1 files changed, 14 insertions, 5 deletions
diff --git a/Parser/tokenizer.c b/Parser/tokenizer.c
index 249bb96..16d311c 100644
--- a/Parser/tokenizer.c
+++ b/Parser/tokenizer.c
@@ -1500,15 +1500,24 @@ tok_get(register struct tok_state *tok, char **p_start, char **p_end)
} while (isdigit(c));
}
if (c == 'e' || c == 'E') {
- exponent:
+ int e;
+ exponent:
+ e = c;
/* Exponent part */
c = tok_nextc(tok);
- if (c == '+' || c == '-')
+ if (c == '+' || c == '-') {
c = tok_nextc(tok);
- if (!isdigit(c)) {
- tok->done = E_TOKEN;
+ if (!isdigit(c)) {
+ tok->done = E_TOKEN;
+ tok_backup(tok, c);
+ return ERRORTOKEN;
+ }
+ } else if (!isdigit(c)) {
tok_backup(tok, c);
- return ERRORTOKEN;
+ tok_backup(tok, e);
+ *p_start = tok->start;
+ *p_end = tok->cur;
+ return NUMBER;
}
do {
c = tok_nextc(tok);