[prev in list] [next in list] [prev in thread] [next in thread] 

List:       python-bugs-list
Subject:    [issue1707] probable bug in code.py with Python 3.0a2
From:       report () bugs ! python ! org (Andre Roberge)
Date:       2007-12-29 4:10:25
Message-ID: 1198901425.7.0.747577606442.issue1707 () psf ! upfronthosting ! co ! za
[Download RAW message or body]


New submission from Andre Roberge:

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()

----------
components: Library (Lib)
messages: 59030
nosy: aroberge
severity: normal
status: open
title: probable bug in code.py with Python 3.0a2
versions: Python 3.0

__________________________________
Tracker <report at bugs.python.org>
<http://bugs.python.org/issue1707>
__________________________________

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic