[New-bugs-announce] [issue20108] cannot pass kwarg `func` to `inspect.getcallargs`

Joost van Zwieten report at bugs.python.org
Thu Jan 2 18:29:15 CET 2014

New submission from Joost van Zwieten:

Consider the following example.

    import inspect
    inspect.getcallargs(lambda **kwargs: None, func=1)

IMHO `getcallargs` should return

    {'kwargs': {'func': 1}}

however, Python (versions 3.3 and 3.4) throws the following exception instead:

    TypeError: getcallargs() got multiple values for argument 'func'

This can be easily solved in `lib/inspect.py` by changing

    def getcallargs(func, *positional, **named):


    def getcallargs(*func_and_positional, **named):
        func, *positional = func_and_positional

Best regards,

Joost van Zwieten

components: Library (Lib)
messages: 207177
nosy: joostvanzwieten
priority: normal
severity: normal
status: open
title: cannot pass kwarg `func` to `inspect.getcallargs`
type: behavior
versions: Python 3.3, Python 3.4

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list