classification
Title: ast.literal_eval fails on octal numbers
Type: Stage:
Components: Library (Lib) Versions: Python 3.2
process
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: Nosy List: fidoman
Priority: normal Keywords:

Created on 2011-12-31 11:02 by fidoman, last changed 2011-12-31 14:39 by benjamin.peterson. This issue is now closed.

Messages (2)
msg150414 - (view) Author: Sergey Dorofeev (fidoman) Date: 2011-12-31 11:02
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
msg150415 - (view) Author: Sergey Dorofeev (fidoman) Date: 2011-12-31 11:05
python 3 feature - should use 0o10
need to rebuild data file :(
History
Date User Action Args
2011-12-31 14:39:32benjamin.petersonsetresolution: rejected -> not a bug
2011-12-31 11:05:14fidomansetstatus: open -> closed
resolution: rejected
messages: + msg150415
2011-12-31 11:02:20fidomancreate