summaryrefslogtreecommitdiff
path: root/Parser
diff options
context:
space:
mode:
authorBenjamin Peterson <benjamin@python.org>2014-06-07 12:39:51 -0700
committerBenjamin Peterson <benjamin@python.org>2014-06-07 12:39:51 -0700
commit3e439797bad59948ff810aeaf7e992b23451ddd6 (patch)
tree130c4172e7d609f3965a814fc751705988c14da7 /Parser
parentMerge issue #21569 from 3.4 (diff)
parentallow the keyword else immediately after (no space) an integer (closes #21642) (diff)
downloadcpython-3e439797bad59948ff810aeaf7e992b23451ddd6.tar.gz
cpython-3e439797bad59948ff810aeaf7e992b23451ddd6.tar.bz2
cpython-3e439797bad59948ff810aeaf7e992b23451ddd6.zip
merge 3.4 (#21642)
Diffstat (limited to 'Parser')
-rw-r--r--Parser/tokenizer.c19
1 files changed, 14 insertions, 5 deletions
diff --git a/Parser/tokenizer.c b/Parser/tokenizer.c
index 6aaa4a9d383..ef7b19fb42f 100644
--- a/Parser/tokenizer.c
+++ b/Parser/tokenizer.c
@@ -1603,15 +1603,24 @@ tok_get(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);