[issue9683] Dead code in py3k inspect module

Andreas Stührk report at bugs.python.org
Thu Aug 26 13:49:37 CEST 2010


Andreas Stührk <andy-python at hammerhartes.de> added the comment:

The correct call is more something like ``inspect.formatargspec(*inspect.getargspec(f))``, which should work for all (Python) functions in Python 3. In Python 2, tuple unpacking was represented using a nested list for the arguments:

>>> def f(x, (y, z)): pass
... 
>>> inspect.getargspec(f).args
['x', ['y', 'z']]

It is impossible to get such a nested list from `getargspec()` now, but if you provide one, you execute the dead code path:

>>> inspect.formatargspec(['x', ['y', 'z']])
TypeError: object of type 'map' has no len()

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue9683>
_______________________________________


More information about the Python-bugs-list mailing list