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: input() crashes in 2.7.6
Type: crash Stage: resolved
Components: Windows Versions: Python 2.7
process
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: Nosy List: VeloxAmbitum, christian.heimes
Priority: normal Keywords:

Created on 2013-12-22 23:29 by VeloxAmbitum, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
python2.7.6 bug.py VeloxAmbitum, 2013-12-22 23:29 Python 2.7.6 Input Bug
Messages (2)
msg206835 - (view) Author: VeloxAmbitum (VeloxAmbitum) Date: 2013-12-22 23:29
Using input(string) to read a number crashes whenever the number is "0*8*" or "0*9*" where * can be any number (i.e., "09", "08", and "0102393" all cause the code to crash).

Crash occurs on Windows 7 x64 running 32 bit Python version 2.7.6 as a Syntax Error:

----------------------------------------------------
Enter a number
>01239123
Traceback (most recent call last):
  File "python2.7.6 bug", line 6, in <module>
    bug()
  File "python2.7.6 bug", line 2, in bug
    number = input("Enter a number\n>");
  File "<string>", line 1
    01239123
           ^
SyntaxError: invalid token

----------------------------------------------------

Can be reproduced from:


def bug():
	number = input("Enter a number\n>");

while True:
	print("0*8* or 0*9* causes bug to appear (* is wildcard):\n");
	bug()
msg206836 - (view) Author: Christian Heimes (christian.heimes) * (Python committer) Date: 2013-12-22 23:35
It's nota bug, it's a feature. Python 2.x interprets numers with a 0 prefix as octal numbers. '8' and '9' are no valid tokens in octal notation.

>>> 010
8
>>> 10
10


http://docs.python.org/2.7/reference/lexical_analysis.html#numeric-literals
History
Date User Action Args
2022-04-11 14:57:55adminsetgithub: 64251
2013-12-22 23:35:19christian.heimessetstatus: open -> closed

nosy: + christian.heimes
messages: + msg206836

resolution: not a bug
stage: resolved
2013-12-22 23:29:59VeloxAmbitumcreate