Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 6d43c5d

Browse files
committed
Raise TypeError, not KeyError, on unknown keyword argument.
1 parent 3f3bb3d commit 6d43c5d

1 file changed

Lines changed: 1 addition & 2 deletions

File tree

Python/ceval.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
2828
XXX how to pass arguments to call_trace?
2929
XXX totally get rid of access stuff
3030
XXX speed up searching for keywords by using a dictionary
31-
XXX unknown keyword shouldn't raise KeyError?
3231
XXX document it!
3332
*/
3433

@@ -449,7 +448,7 @@ eval_code2(co, globals, locals,
449448
}
450449
if (j >= co->co_argcount) {
451450
if (kwdict == NULL) {
452-
err_setval(KeyError/*XXX*/, keyword);
451+
err_setval(TypeError, keyword);
453452
goto fail;
454453
}
455454
mappinginsert(kwdict, keyword, value);

0 commit comments

Comments
 (0)