print statement does autocall inside interactive indented blocks

Bug #384713 reported by eteq
24
This bug affects 4 people
Affects Status Importance Assigned to Milestone
IPython
New
Undecided
Unassigned
ipython (Ubuntu)
Triaged
High
Unassigned
Lucid
Triaged
High
Unassigned

Bug Description

If I am in an interactive shell and do:

In [3]: class A(object):
   ...: def __init__(self):
   ...: print 'make'
   ...:

Everything operates correctly. However, If I then arrow up to change something in the class definition, say, for example, as below, I get this error:

In [18]: class A(object):
    def __init__(self):
        print 'not make'
-------> print('not make')
------------------------------------------------------------
IndentationError: expected an indented block (<ipython console>, line 3)

It's obvious what's happening - the autocall magic thinks print is a function rather than a statement. If I turn autocall off, all is happy... but can this be fixed so that it works as it should for just the case of a line that begins with "print"?

Revision history for this message
Michael Amy (mike-felspar) wrote :

It's possible to work around this problem even if autocall is on, by putting brackets around the thing you are trying to print, which is usually acceptable.

It would be better if it were fixed.

Revision history for this message
Brian Murray (brian-murray) wrote :

This is still an issue with 0.10-1 in Lucid.

Changed in ipython (Ubuntu):
status: New → Triaged
importance: Undecided → High
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.