summaryrefslogtreecommitdiffstats
path: root/Parser/tokenizer.c
diff options
context:
space:
mode:
authorTim Peters <tim.peters@gmail.com>2001-08-27 19:19:28 (GMT)
committerTim Peters <tim.peters@gmail.com>2001-08-27 19:19:28 (GMT)
commit9aa70d93aae89a9404a58f32f3fcd3c72b1ee56b (patch)
tree1ce75d8726e760f3f47d60503bdb9eefd4227a42 /Parser/tokenizer.c
parentde1d4957c0bb4d920f130cd809bff865b3ef3c48 (diff)
downloadcpython-9aa70d93aae89a9404a58f32f3fcd3c72b1ee56b.zip
cpython-9aa70d93aae89a9404a58f32f3fcd3c72b1ee56b.tar.gz
cpython-9aa70d93aae89a9404a58f32f3fcd3c72b1ee56b.tar.bz2
SF bug [#455775] float parsing discrepancy.
PyTokenizer_Get: error if exponent contains no digits (3e, 2.0e+, ...).
Diffstat (limited to 'Parser/tokenizer.c')
-rw-r--r--Parser/tokenizer.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/Parser/tokenizer.c b/Parser/tokenizer.c
index 2397969..7270629 100644
--- a/Parser/tokenizer.c
+++ b/Parser/tokenizer.c
@@ -756,9 +756,7 @@ PyTokenizer_Get(register struct tok_state *tok, char **p_start,
if (c == 'l' || c == 'L')
c = tok_nextc(tok);
else {
- /* Accept floating point numbers.
- XXX This accepts incomplete things like
- XXX 12e or 1e+; worry run-time */
+ /* Accept floating point numbers. */
if (c == '.') {
fraction:
/* Fraction */
@@ -771,9 +769,14 @@ PyTokenizer_Get(register struct tok_state *tok, char **p_start,
c = tok_nextc(tok);
if (c == '+' || c == '-')
c = tok_nextc(tok);
- while (isdigit(c)) {
- c = tok_nextc(tok);
+ if (!isdigit(c)) {
+ tok->done = E_TOKEN;
+ tok_backup(tok, c);
+ return ERRORTOKEN;
}
+ do {
+ c = tok_nextc(tok);
+ } while (isdigit(c));
}
#ifndef WITHOUT_COMPLEX
if (c == 'j' || c == 'J')