[New-bugs-announce] [issue20816] inspect.getcallargs() attempts to iterate over None

Jeremiah Lowin report at bugs.python.org
Sat Mar 1 17:00:50 CET 2014


New submission from Jeremiah Lowin:

Tested in Python 3.3 and Python 3.4.0rc1 5e05d7d3db9c

If a function has keyword-only arguments but no keyword-only defaults, then calling inspect.getcallargs with no arguments results in the wrong TypeError being raised.

Example:

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

Result: 
    TypeError: argument of type 'NoneType' is not iterable

Expected Result: 
    TypeError: fn() missing 1 required keyword-only argument: 'a'

----------
components: Library (Lib)
messages: 212509
nosy: jlowin
priority: normal
severity: normal
status: open
title: inspect.getcallargs() attempts to iterate over None
type: behavior
versions: Python 3.3, Python 3.4

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


More information about the New-bugs-announce mailing list