This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: cannot pass kwarg `func` to `inspect.getcallargs`
Type: behavior Stage: resolved
Components: Library (Lib) Versions: Python 3.3, Python 3.4
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: joostvanzwieten, python-dev
Priority: normal Keywords:

Created on 2014-01-02 17:29 by joostvanzwieten, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Messages (2)
msg207177 - (view) Author: Joost van Zwieten (joostvanzwieten) Date: 2014-01-02 17:29
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):

into

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

Best regards,

Joost van Zwieten
msg207179 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2014-01-02 18:27
New changeset b0d472e3ff42 by Benjamin Peterson in branch '3.3':
avoid parameter name clash (closes #20108)
http://hg.python.org/cpython/rev/b0d472e3ff42

New changeset c265675cd8e2 by Benjamin Peterson in branch 'default':
merge 3.3 (closes #20108)
http://hg.python.org/cpython/rev/c265675cd8e2
History
Date User Action Args
2022-04-11 14:57:56adminsetgithub: 64307
2014-01-02 18:27:05python-devsetstatus: open -> closed

nosy: + python-dev
messages: + msg207179

resolution: fixed
stage: resolved
2014-01-02 17:29:15joostvanzwietencreate