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.

Author aroberge
Recipients aroberge
Date 2007-12-29.04:10:24
SpamBayes Score 0.01709547
Marked as misclassified No
Message-id <1198901425.7.0.747577606442.issue1707@psf.upfronthosting.co.za>
In-reply-to
Content
There appears to be a bug in code.py in Python 3.0a2/a1.

I believe that the body of
InteractiveConsole().raw_input()
should be changed from

       sys.stdout.write(prompt)
       sys.stdout.flush()
       return sys.stdin.readline()

to
      return input(prompt)

Here's a sample session.

Python 3.0a1 (py3k, Nov 27 2007, 07:40:26)
[GCC 4.0.1 (Apple Inc. build 5465)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import code
>>> console = code.InteractiveConsole()
>>> console.interact()
Python 3.0a1 (py3k, Nov 27 2007, 07:40:26)
[GCC 4.0.1 (Apple Inc. build 5465)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
(InteractiveConsole)
>>> for i in range(3):
...   print(i)
0
1
2
>>>  # Notice how I could only enter one line inside the loop.
>>>  # Let's try again, with a different definition of raw_input()
>>> import code
>>> console = code.InteractiveConsole()
>>> console.raw_input = input
>>> console.interact()
Python 3.0a1 (py3k, Nov 27 2007, 07:40:26)
[GCC 4.0.1 (Apple Inc. build 5465)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
(InteractiveConsole)
>>> for i in range(3):
...   print(i)
...
0
1
2
>>>  # Notice how I had to enter an empty line to end the loop - as it
should be.

The same problem affects function definitions - it is impossible to
define a function body with more than one line when running code.interact()
History
Date User Action Args
2007-12-29 04:10:26arobergesetspambayes_score: 0.0170955 -> 0.01709547
recipients: + aroberge
2007-12-29 04:10:25arobergesetspambayes_score: 0.0170955 -> 0.0170955
messageid: <1198901425.7.0.747577606442.issue1707@psf.upfronthosting.co.za>
2007-12-29 04:10:25arobergelinkissue1707 messages
2007-12-29 04:10:24arobergecreate