From: Benjamin Peterson Date: Wed, 31 Oct 2012 18:22:12 +0000 (-0400) Subject: avoid a function call with redundant checks for dict size X-Git-Tag: v2.7.4rc1~426 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=47fa4d54e865b7633babe8144009f01770cc9d82;p=thirdparty%2FPython%2Fcpython.git avoid a function call with redundant checks for dict size --- diff --git a/Objects/dictobject.c b/Objects/dictobject.c index 664b58c8c5bc..ba36b180cad2 100644 --- a/Objects/dictobject.c +++ b/Objects/dictobject.c @@ -1353,7 +1353,7 @@ dict_fromkeys(PyObject *cls, PyObject *args) if (d == NULL) return NULL; - if (PyDict_CheckExact(d) && PyDict_Size(d) == 0) { + if (PyDict_CheckExact(d) && ((PyDictObject *)d)->ma_used == 0) { if (PyDict_CheckExact(seq)) { PyDictObject *mp = (PyDictObject *)d; PyObject *oldvalue;