summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Lib/test/test_compile.py2
-rw-r--r--Misc/NEWS3
-rw-r--r--Parser/tokenizer.c2
3 files changed, 5 insertions, 2 deletions
diff --git a/Lib/test/test_compile.py b/Lib/test/test_compile.py
index e8695ac..e2a0ebe 100644
--- a/Lib/test/test_compile.py
+++ b/Lib/test/test_compile.py
@@ -183,7 +183,7 @@ if 1:
for arg in ["077787", "0xj", "0x.", "0e", "090000000000000",
"080000000000000", "000000000000009", "000000000000008",
"0b42", "0BADCAFE", "0o123456789", "0b1.1", "0o4.2",
- "0b101j2", "0o153j2", "0b100e1", "0o777e1"]:
+ "0b101j2", "0o153j2", "0b100e1", "0o777e1", "0o8", "0o78"]:
self.assertRaises(SyntaxError, eval, arg)
self.assertEqual(eval("0777"), 511)
diff --git a/Misc/NEWS b/Misc/NEWS
index 3930929..52aee80 100644
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -12,6 +12,9 @@ What's New in Python 2.6 alpha 3?
Core and builtins
-----------------
+- Issue #2681: The octal literal ``0o8`` was incorrecly acctepted. Now it
+ properly raises a SyntaxError.
+
- Patch #2617: Reserved -J and -X arguments for Jython, IronPython and other
implementations of Python.
diff --git a/Parser/tokenizer.c b/Parser/tokenizer.c
index 29fb114..1d0a4aa 100644
--- a/Parser/tokenizer.c
+++ b/Parser/tokenizer.c
@@ -1351,7 +1351,7 @@ tok_get(register struct tok_state *tok, char **p_start, char **p_end)
else if (c == 'o' || c == 'O') {
/* Octal */
c = tok_nextc(tok);
- if (c < '0' || c > '8') {
+ if (c < '0' || c >= '8') {
tok->done = E_TOKEN;
tok_backup(tok, c);
return ERRORTOKEN;