thewisenerd / python-on-a-chip

Automatically exported from code.google.com/p/python-on-a-chip
Other
0 stars 0 forks source link

Fix ipm hang on two-unknowns error #120

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
ipm> foo bar

<waits forever>

Original issue reported on code.google.com by dwhall...@gmail.com on 6 Aug 2010 at 3:38

GoogleCodeExporter commented 9 years ago
When Python compiles the two word string "foo bar", it generates:

>>> compile("foo foo", "<ipm>", "single")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "<ipm>", line 1
    foo foo
         ^
SyntaxError: unexpected EOF while parsing

The "unexpected EOF..." is exactly the same message one gets when inputting a 
valid multi-line piece of code.  So I can't catch this as a special case.

HOWEVER, I can print a multi-line input prompt ".... " that Python programmers 
expect and gives them cause to finish off the multi-line input with an extra 
carriage return.

Original comment by dwhall...@gmail.com on 8 Aug 2010 at 6:42

GoogleCodeExporter commented 9 years ago
r569
- Added lines in src/tools/ipm.py to print extra-input prompt ".... " during 
multi-line interactive session.

Affects ipm only.  Tested manually via ipm.
Mainlined directly.

Original comment by dwhall...@gmail.com on 8 Aug 2010 at 6:44

GoogleCodeExporter commented 9 years ago
r573
- Using Python module "code" to compile lines.

code.compile_command() returns None if the code is complete.  This change fixes 
the case of two unknown.  A SyntaxError is returned for "foo foo".

Post mainline check-in.  Tested via ipm manually.

Original comment by dwhall...@gmail.com on 14 Aug 2010 at 5:57

GoogleCodeExporter commented 9 years ago
This fix doesn't work.  When defining a function, ipm takes input indefinitely.

Original comment by dwhall...@gmail.com on 14 Aug 2010 at 6:54

GoogleCodeExporter commented 9 years ago
r575
- Removed rstrip that was causing trouble.

Mainlined directly.

Original comment by dwhall...@gmail.com on 14 Aug 2010 at 7:04