[IPython-dev] Evaluation bug in Interpreter?

Gael Varoquaux gael.varoquaux at normalesup.org
Wed Aug 13 11:44:09 EDT 2008

I hit this behavior, with the ipython1 interpreter:

In [6]: from IPython.kernel.core.interpreter import Interpreter

In [7]: i = Interpreter()

In [8]: i.execute(u'dedent(""" a\n b\n c""")\n\n')
IndentationError                          Traceback (most recent call

/home/gvaroquaux/dev/ipython/ipython-frontend/scripts/<ipython console>
in <module>()

in execute_python(self, python)
    352         for cmd in commands:
    353             try:
--> 354                 code = self.command_compiler(cmd, self.filename,
    355             except (SyntaxError, OverflowError, ValueError), e:
    356                 self.traceback_trap.args = sys.exc_info()

/usr/lib/python2.5/codeop.pyc in __call__(self, source, filename, symbol)
    164         - Raise SyntaxError, ValueError or OverflowError if the
command is a
    165           syntax error (OverflowError and ValueError can be
produced by
    166           malformed literals).
    167         """
--> 168         return _maybe_compile(self.compiler, source, filename,

/usr/lib/python2.5/codeop.pyc in _maybe_compile(compiler, source,
filename, symbol)
     97         return code
     98     if not code1 and repr(err1) == repr(err2):
---> 99         raise SyntaxError, err1
    101 def _compile(source, filename, symbol):

IndentationError: unexpected indent (<string>, line 1)

It seems to me that the input is valid Python.



More information about the IPython-dev mailing list