[IPython-dev] Evaluation bug in Interpreter?

Gael Varoquaux gael.varoquaux@normalesup....
Wed Aug 13 10:44:09 CDT 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
last)

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

/home/gvaroquaux/dev/ipython/ipython-frontend/IPython/kernel/core/interpreter.pyc
in execute_python(self, python)
    352         for cmd in commands:
    353             try:
--> 354                 code = self.command_compiler(cmd, self.filename,
'single')
    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,
symbol)

/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
    100 
    101 def _compile(source, filename, symbol):

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

It seems to me that the input is valid Python.

Cheers,

Gaël


More information about the IPython-dev mailing list