You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
assignee='https://github.com/1st1'closed_at=<Date2014-03-27.22:28:05.793>created_at=<Date2014-03-01.16:00:50.831>labels= ['type-bug', 'library']
title='inspect.getcallargs() attempts to iterate over None'updated_at=<Date2014-03-27.22:28:51.581>user='https://bugs.python.org/jlowin'
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.
If a function has keyword-only arguments, then inspect.getcallargs checks if the argument is in kwonlydefaults. However, kwonlydefaults is None if no defaults were specified. In that situation, 'kwarg in kwonlydefaults' raises the TypeError.
The quick fix is simply to test kwonlydefaults before testing if kwarg is in it.
The test for this situation is a little verbose because a TypeError is expected and one is raised, just the wrong one, so I parse the error message.
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: