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: v3.2.4rc1~389 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=9892f52145a72729253c0e71790feef49d7892af;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 d3c5eac37071..c10bfccdce67 100644 --- a/Objects/dictobject.c +++ b/Objects/dictobject.c @@ -1335,7 +1335,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;