[New-bugs-announce] [issue13688] ast.literal_eval fails on octal numbers

Sergey Dorofeev report at bugs.python.org
Sat Dec 31 12:02:55 CET 2011


New submission from Sergey Dorofeev <fidoman at users.sourceforge.net>:

Python 3.2.2 (default, Nov 16 2011, 10:58:44) [C] on sunos5
Type "help", "copyright", "credits" or "license" for more information.
>>> import ast
>>> ast.literal_eval('10')
10
>>> ast.literal_eval('0x10')
16
>>> ast.literal_eval('010')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/opt/python322/lib/python3.2/ast.py", line 48, in literal_eval
    node_or_string = parse(node_or_string, mode='eval')
  File "/opt/python322/lib/python3.2/ast.py", line 36, in parse
    return compile(source, filename, mode, PyCF_ONLY_AST)
  File "<unknown>", line 1
    010
      ^
SyntaxError: invalid token

----------
components: Library (Lib)
messages: 150414
nosy: fidoman
priority: normal
severity: normal
status: open
title: ast.literal_eval fails on octal numbers
versions: Python 3.2

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue13688>
_______________________________________


More information about the New-bugs-announce mailing list