We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
GitHub fields:
assignee = None closed_at = <Date 2009-02-02.19:02:54.879> created_at = <Date 2009-02-02.18:52:30.828> labels = ['build', 'invalid'] title = 'Error with Eval' updated_at = <Date 2009-02-02.19:04:12.212> user = 'https://bugs.python.org/davidnicol'
bugs.python.org fields:
activity = <Date 2009-02-02.19:04:12.212> actor = 'ezio.melotti' assignee = 'none' closed = True closed_date = <Date 2009-02-02.19:02:54.879> closer = 'rhettinger' components = ['None'] creation = <Date 2009-02-02.18:52:30.828> creator = 'davidnicol' dependencies = [] files = [] hgrepos = [] issue_num = 5133 keywords = [] message_count = 3.0 messages = ['80982', '80984', '80985'] nosy_count = 3.0 nosy_names = ['rhettinger', 'ezio.melotti', 'davidnicol'] pr_nums = [] priority = 'normal' resolution = 'not a bug' stage = None status = 'closed' superseder = None type = 'compile error' url = 'https://bugs.python.org/issue5133' versions = ['Python 2.6']
The text was updated successfully, but these errors were encountered:
The single line statements:
eval("08") ; and eval("09")
both crash; while
eval("07") works fine
Sorry, something went wrong.
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:
'000987'.lstrip('0') --> '987'
Or, you can use the int() function:
int('000987')
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.
The number displayed is the decimal equivalent: >>> 07 7 >>> 010 8
No branches or pull requests
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: