homepage

This issue tracker has been migrated to GitHub , and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

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 2022年04月11日 14:57 by admin. 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
2022年04月11日 14:57:25adminsetgithub: 57897
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

AltStyle によって変換されたページ (->オリジナル) /