New submission from David Nicol da...@thenicols.net:
The single line statements:
eval(08) ; and
eval(09)
both crash; while
eval(07) works fine
--
components: None
messages: 80982
nosy: davidnicol
severity: normal
status: open
title: Error with Eval
type: compile error
versions:
Ezio Melotti ezio.melo...@gmail.com added the comment:
The leading zero is used to define octal numbers, 8 and 9 are not valid
octal digits, see
http://docs.python.org/reference/lexical_analysis.html#integer-and-long-integer-literals
Also, you don't need to use eval to reproduce that behavior.
Raymond Hettinger rhettin...@users.sourceforge.net added the comment:
They don't crash. They raise a SyntaxError because the 08 and 09
are invalid octal literals.
If you're working with decimal literals that are padded on the left with
zeroes, those need to be stripped off before conversion: