Comment 1 for bug 290677

Revision history for this message
Marcelo Fernandez (fernandezm) wrote :

Commenting the line 2018 in /usr/share/python-support/ipython/IPython/iplib.py (IPython 0.8.4, Ubuntu 8.10 version) seems to fix this issue. But I don't know if this breaks anything else... in my informal tests it works fine.

1985 def runsource(self, source, filename='<input>', symbol='single'):
[...]
2014 # if the source code has leading blanks, add 'if 1:\n' to it
2015 # this allows execution of indented pasted code. It is tempting
2016 # to add '\n' at the end of source to run commands like ' a=1'
2017 # directly, but this fails for more complicated scenarios
2018 #source=source.encode(self.stdin_encoding)
2019 if source[:1] in [' ', '\t']:
2020 source = 'if 1:\n%s' % source
2021
2022 try:
2023 code = self.compile(source,filename,symbol)
2024 except (OverflowError, SyntaxError, ValueError, TypeError):
2025 # Case 1
2026 self.showsyntaxerror(filename)
2027 return None

I'll take a look at the trunk version. Could you confirm if this fix doesn't affect the rest of the program?

Thanks
Marcelo