Kaydet (Commit) 31aca4bf authored tarafından Oren Milman's avatar Oren Milman Kaydeden (comit) Raymond Hettinger

bpo-31586: Use _count_element fast path for real dicts.

üst c740e4fe
......@@ -2277,7 +2277,9 @@ _count_elements(PyObject *self, PyObject *args)
dict_setitem = _PyType_LookupId(&PyDict_Type, &PyId___setitem__);
if (mapping_get != NULL && mapping_get == dict_get &&
mapping_setitem != NULL && mapping_setitem == dict_setitem) {
mapping_setitem != NULL && mapping_setitem == dict_setitem &&
PyDict_Check(mapping))
{
while (1) {
/* Fast path advantages:
1. Eliminate double hashing
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment