From 8bcf369cf9890ef7cfeb6f199d46932b7c249662 Mon Sep 17 00:00:00 2001 From: Guido van Rossum Date: Mon, 21 Oct 1996 15:12:32 +0000 Subject: Support passing in an empty dictionary of keywords to newinstanceobject. --- Objects/classobject.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Objects/classobject.c b/Objects/classobject.c index 4ac6a0e..f392fae 100644 --- a/Objects/classobject.c +++ b/Objects/classobject.c @@ -347,7 +347,9 @@ newinstanceobject(class, arg, kw) if (init == NULL) { err_clear(); if (arg != NULL && (!is_tupleobject(arg) || - gettuplesize(arg) != 0) || kw != NULL) { + gettuplesize(arg) != 0) + || kw != NULL && (!is_dictobject(kw) || + getdictsize(kw) != 0)) { err_setstr(TypeError, "this constructor takes no arguments"); DECREF(inst); -- cgit v0.12