"Internal Python error in the inspect module"

Bug #249548 reported by harry666t
4
This bug affects 1 person
Affects Status Importance Assigned to Milestone
IPython
Fix Released
Undecided
Fernando Perez

Bug Description

I was toying with IPython, and I've observed this bug:

[1]: def foo(a, (x,y,z) = (1,2,3)): print a, x, y, z
...:

[2]: foo(1,2)
ERROR: Internal Python error in the inspect module.
Below is the traceback from this internal error.

Traceback (most recent call last):
  File "/var/lib/python-support/python2.5/IPython/ultraTB.py", line 662, in text
    locals,formatvalue=var_repr))
  File "/usr/lib/python2.5/inspect.py", line 812, in formatargvalues
    specs.append(strseq(args[i], convert, join))
  File "/usr/lib/python2.5/inspect.py", line 765, in strseq
    return join(map(lambda o, c=convert, j=join: strseq(o, c, j), object))
  File "/usr/lib/python2.5/inspect.py", line 765, in <lambda>
    return join(map(lambda o, c=convert, j=join: strseq(o, c, j), object))
  File "/usr/lib/python2.5/inspect.py", line 767, in strseq
    return convert(object)
  File "/usr/lib/python2.5/inspect.py", line 809, in convert
    return formatarg(name) + formatvalue(locals[name])
KeyError: 'x'

IPython's exception reporting continues...

---------------------------------------------------------------------------
TypeError Traceback (most recent call last)

/home/harry/<ipython console> in <module>()

/home/harry/<ipython console> in foo(***failed resolving arguments***)

TypeError: 'int' object is not iterable
> <ipython console>(1)foo()

ipdb>

The regular Python interpreter just says:

>>> def foo(a, (x,y,z) = (1,2,3)):
... print a, x, y, z
...
>>> foo(1,2)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "<stdin>", line 1, in foo
TypeError: 'int' object is not iterable

This seems to be related to some IPython-specific functionality, although I have no understanding of its internals... I don't know if this error even matters at all, since there's already another one related to passing wrong arguments to a function - I'm just making sure someone knows that there's badness in that "inspect" module...

Revision history for this message
Fernando Perez (fdo.perez) wrote : Re: [Bug 249548] [NEW] "Internal Python error in the inspect module"

On Thu, Jul 17, 2008 at 10:51 AM, harry666t <email address hidden> wrote:
> Public bug reported:
>
> I was toying with IPython, and I've observed this bug:
>
> [1]: def foo(a, (x,y,z) = (1,2,3)): print a, x, y, z
> ...:
>
> [2]: foo(1,2)
> ERROR: Internal Python error in the inspect module.
> Below is the traceback from this internal error.

Great, thanks! I'd never had a reproducible test to cause this
failure. Having one now makes it possible to actually track the bug
down.

Best,

f

Changed in ipython:
assignee: nobody → fdo.perez
status: New → Confirmed
Revision history for this message
Neal McBurnett (nealmcb) wrote :

I ran across this old bug when I encountered another ipython "Internal Python error in the inspect module" error, running Ubuntu Precise.

When I try the code here using ipython 0.12.1+dfsg-0ubuntu1 It fails in a different way:

----> 1 def foo(a, (x,y,z) = (1,2,3)): print a, x, y, z

TypeError: 'int' object is not iterable

So perhaps this bug should be marked as closed?

(
FYI, My error ends with File "/usr/lib/python2.7/inspect.py", line 580, in findsource
    if pat.match(lines[lnum]): break
IndexError: list index out of range
and it looks sort of like the one discussed recently at https://github.com/ipython/ipython/issues/1456
)

Revision history for this message
Neal McBurnett (nealmcb) wrote :
Changed in ipython:
status: Confirmed → Fix Released
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.