Closed GoogleCodeExporter closed 8 years ago
On my setup I'm calling the _runsource() you made for me from wxPython's shell
and I can do this fine:
>>> a = 12
>>> while True:
... a = a + 1
... if a > 15:
... break
...
>>> a
16
>>>
It appears that it was me that introduced this bug. You used my code for
onecmd() and I did not strip the trailing newline before calling _runsource().
The problem is that you can't always strip the newline or you will never finish
a loop. I think the fix is to do an rstrip() on each new line as it is
gathered. Then a newline and the new line. So instead of this:
line += self.stdin.readline()
do this:
new_line = self.stdin.readline().rstrip()
line += '\n' + new_line
Original comment by j...@missioncognition.net
on 26 Jun 2011 at 4:27
Or you could change the line to this:
line += '\n' + self.stdin.readline().rstrip()
It seems to work in all the test cases I tried.
Original comment by j...@missioncognition.net
on 26 Jun 2011 at 8:21
Thank you for the prompt fix. I've applied it and tested it on desktop and
mbed and it works nicely.
Original comment by dwhall...@gmail.com
on 29 Jun 2011 at 2:33
This issue was closed by revision df87e0f232f7.
Original comment by dwhall...@gmail.com
on 29 Jun 2011 at 2:36
Original issue reported on code.google.com by
dwhall...@gmail.com
on 26 Jun 2011 at 3:31