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

2014-03-01 Thread Jeremiah Lowin
Jeremiah Lowin added the comment: The bug is caused by a list of names not getting properly expanded when generating the error message. This patch fixes it (simply by adding a * in the appropriate place) and tests that a TypeError, not an IndexError, is raised. -- keywords: +patch

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

2014-03-01 Thread Jeremiah Lowin
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

[issue20816] inspect.getcallargs() attempts to iterate over None

2014-03-01 Thread Jeremiah Lowin
Jeremiah Lowin added the comment: Apologies, the patch is attached here. -- keywords: +patch Added file: http://bugs.python.org/file34260/issue20816.patch ___ Python tracker <http://bugs.python.org/issue20

[issue20816] inspect.getcallargs() attempts to iterate over None

2014-03-01 Thread Jeremiah Lowin
Jeremiah Lowin added the comment: I created a patch to resolve this. 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 kwonlydef

[issue20816] inspect.getcallargs() attempts to iterate over None

2014-03-01 Thread Jeremiah Lowin
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: >>> impor