[Python-modules-team] Bug#473018: Line Entry Edge Case Error

aerusso aerusso at andrew.cmu.edu
Thu Mar 27 19:23:42 UTC 2008


Package: ipython
Version: 0.8.2.dfsg-2
Severity: normal

--- Please enter the report below this line. ---
Interactively entering the following, allowing ipython
to automatically provide indentation:

def a(b):
  b()
 return True

causes an indentation error (as expected). I press "up"
to retrieve the history, and go back to add in the
additional space before "return". Pressing enter causes:

NameError: name 'e' is not defined

Weirder still: if True is replaced with 'q' and some value
is assigned to the variable q, ipython returns that value
as the next "out" result. Find transcript below.

The "call" b() appears to not matter (it can be replaced
with other code, for instance "b=b").

-----------------------------------------------------------------------------------------------------------------
Python 2.4.5 (#2, Mar 12 2008, 00:15:51)
Type "copyright", "credits" or "license" for more information.

IPython 0.8.2 -- An enhanced Interactive Python.
?         -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help      -> Python's own help system.
object?   -> Details about 'object'. ?object also works, ?? prints more.

In [1]: def a(b):
   ...:     b()
   ...:    return True
------------------------------------------------------------
IndentationError: unindent does not match any outer indentation level (<ipython console>, line 3)


In [2]: def a(b):
    b()
    return True
---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)

/home/antonio/<ipython console>

NameError: name 'e' is not defined

In [3]: def a(b):
    b()
   return True
------------------------------------------------------------
IndentationError: unindent does not match any outer indentation level (<ipython console>, line 3)


In [6]: def a(b):
    b()
    return q
---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)

/home/antonio/<ipython console>

NameError: name 'q' is not defined

In [7]: q = 123456

In [8]: def a(b):
    b()
   return q
------------------------------------------------------------
IndentationError: unindent does not match any outer indentation level (<ipython console>, line 3)


In [11]: def a(b):
    b()
    return q
Out[11]: 123456

In [12]:


--- System information. ---
Architecture: i386
Kernel:       Linux 2.6.22-3-686

Debian Release: lenny/sid
  990 testing         ftp.debian.org
  600 unstable        ftp.debian.org
  400 stable          ftp.debian.org

--- Package information. ---
Depends             (Version) | Installed
=============================-+-===========
python                        | 2.4.4-6
python-pexpect                | 2.1-1
python-support     (>= 0.7.1) | 0.7.7
python2.4                     | 2.4.5-1
python2.5                     | 2.5.1-7






More information about the Python-modules-team mailing list