[Python-modules-team] Bug#374625: python2.3-ipython: help built-in function does not work

Alexandre Fayolle afayolle at debian.org
Tue Jun 20 10:12:48 UTC 2006


Package: python2.3-ipython
Version: 0.7.2-3
Severity: important

Hi,

When using python2.3-ipython, the help function is broken. The problem
does not occur with python2.4-ipython, so it seems to me that ipython
uses some code which depends on python2.4 and is not compatible with
python2.3. 

I have also been able to run the test case on an older installation of
python2.3-ipython, using version 0.7.1.fix1-2, which worked fine. 

I set the priority to important, because getting help interactively is
one of the main goals of ipython. If you feel this is too high, please
downgrade the severity. 


One possible solution, if the above analysis is true, would be dropping
the python2.3-ipython package altogether. 


Steps to reproduce the bug: 

Put the following sample.py file in your current working directory:

def foo():
    """test function"""
        return True


Then launch ipython, import sample and run help(sample)

$ python2.3-ipython
Python 2.3.5 (#2, Jun 13 2006, 23:12:55) 
Type "copyright", "credits" or "license" for more information.

IPython 0.7.2 -- An enhanced Interactive Python.
?       -> Introduction to IPython's features.
%magic  -> Information about IPython's 'magic' % functions.
help    -> Python's own help system.
object? -> Details about 'object'. ?object also works, ?? prints more.

In [1]: import sample

In [2]: help(sample) 
---------------------------------------------------------------------------
exceptions.TypeError                                 Traceback (most recent call last)

/home/alf/dev/public/ail/<ipython console> 

/usr/lib/python2.3/site.py in __call__(self, *args, **kwds)
    317     def __call__(self, *args, **kwds):
    318         import pydoc
--> 319         return pydoc.help(*args, **kwds)
    320 
    321 __builtin__.help = _Helper()

/usr/lib/python2.3/pydoc.py in __call__(self, request)
   1546     def __call__(self, request=None):
   1547         if request is not None:
-> 1548             self.help(request)
   1549         else:
   1550             self.intro()

/usr/lib/python2.3/pydoc.py in help(self, request)
   1582             elif request: doc(request, 'Help on %s:')
   1583         elif isinstance(request, Helper): self()
-> 1584         else: doc(request, 'Help on %s:')
   1585         self.output.write('\n')
   1586 

/usr/lib/python2.3/pydoc.py in doc(thing, title, forceload)
   1373         elif module and module is not object:
   1374             desc += ' in module ' + module.__name__
-> 1375         pager(title % desc + '\n\n' + text.document(object, name))
   1376     except (ImportError, ErrorDuringImport), value:
   1377         print value

/usr/lib/python2.3/pydoc.py in document(self, object, name, *args)
    281         # by lacking a __name__ attribute) and an instance.
    282         try:
--> 283             if inspect.ismodule(object): return self.docmodule(*args)
    284             if inspect.isclass(object): return self.docclass(*args)
    285             if inspect.isroutine(object): return self.docroutine(*args)

/usr/lib/python2.3/pydoc.py in docmodule(self, object, name, mod)
    961         funcs = []
    962         for key, value in inspect.getmembers(object, inspect.isroutine):
--> 963             if inspect.isbuiltin(value) or inspect.getmodule(value) is object:
    964                 if visiblename(key):
    965                     funcs.append((key, value))

/usr/lib/python2.3/inspect.py in getmodule(object)
    380     for module in sys.modules.values():
    381         if hasattr(module, '__file__'):
--> 382             modulesbyfile[getabsfile(module)] = module.__name__
    383     if file in modulesbyfile:
    384         return sys.modules.get(modulesbyfile[file])

/usr/lib/python2.3/inspect.py in getabsfile(object)
    361     The idea is for each object to have a unique origin, so this routine
    362     normalizes the result as much as possible."""
--> 363     return os.path.normcase(
    364         os.path.abspath(getsourcefile(object) or getfile(object)))
    365 

/usr/lib/python2.3/inspect.py in getsourcefile(object)
    346 def getsourcefile(object):
    347     """Return the Python source file an object was defined in, if it exists."""
--> 348     filename = getfile(object)
    349     if string.lower(filename[-4:]) in ['.pyc', '.pyo']:
    350         filename = filename[:-4] + '.py'

/usr/lib/python2.3/inspect.py in getfile(object)
    326     if iscode(object):
    327         return object.co_filename
--> 328     raise TypeError('arg is not a module, class, method, '
    329                     'function, traceback, frame, or code object')
    330 

TypeError: arg is not a module, class, method, function, traceback, frame, or code object



-- System Information:
Debian Release: testing/unstable
  APT prefers unstable
  APT policy: (500, 'unstable')
Architecture: i386 (i686)
Shell:  /bin/sh linked to /bin/bash
Kernel: Linux 2.6.16-2-686
Locale: LANG=fr_FR at euro, LC_CTYPE=fr_FR at euro (charmap=ISO-8859-15)

Versions of packages python2.3-ipython depends on:
ii  ipython-common                0.7.2-3    enhanced interactive Python shell 
ii  python                        2.3.5-10   An interactive high-level object-o
ii  python2.3                     2.3.5-14   An interactive high-level object-o

Versions of packages python2.3-ipython recommends:
ii  python-numeric [python2.3-num 24.2-3     Numerical (matrix-oriented) Mathem
ii  python-numeric-ext [python2.3 24.2-3     Extension modules for Numeric Pyth
ii  python2.3-pexpect             2.0-2      Python 2.3.x module for automating

-- no debconf information




More information about the Python-modules-team mailing list