[New-bugs-announce] [issue20817] inspect.getcallargs() raises the wrong error if 3+ arguments are missing

Jeremiah Lowin report at bugs.python.org
Sat Mar 1 17:35:04 CET 2014


New submission from Jeremiah Lowin:

If inspect.getcallargs() is called on a function and three or more arguments are missing, an IndexError is raised instead of the expected TypeError.

This bug is present in Python 3.3 and 3.4.0 rc1 (5e05d7d3db9c). However, it worked as expected in Python 2.7.6.

Example:

>>> import inspect
>>> def fn(a, b, c):
>>>     pass
>>> inspect.getcallargs(fn)

Result: 
    IndexError: tuple index out of range
Expected:
    TypeError: fn() missing 3 required positional arguments: 'a', 'b' and 'c'

----------
components: Library (Lib)
messages: 212514
nosy: jlowin
priority: normal
severity: normal
status: open
title: inspect.getcallargs() raises the wrong error if 3+ arguments are missing
type: behavior
versions: Python 3.3, Python 3.4

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


More information about the New-bugs-announce mailing list