Kaydet (Commit) 9d60b944 authored tarafından Raymond Hettinger's avatar Raymond Hettinger

Sync-up lru_cache() C code with space saving feature in the Python version.

üst 44844ccc
......@@ -709,6 +709,12 @@ lru_cache_make_key(PyObject *args, PyObject *kwds, int typed)
/* short path, key will match args anyway, which is a tuple */
if (!typed && !kwds) {
if (PyTuple_GET_SIZE(args) == 1) {
/* Save space and improve speed by unwrapping 1-tuples */
key = PyTuple_GET_ITEM(args, 0);
Py_INCREF(key);
return key;
}
Py_INCREF(args);
return args;
}
......
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