Message334047
Suggested code for the open question listed above:
--- a/Modules/_functoolsmodule.c
+++ b/Modules/_functoolsmodule.c
@@ -733,6 +733,15 @@ 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) {
+ key = PyTuple_GET_ITEM(args, 0);
+ if (!PySequence_Check(key)) {
+ /* For scalar keys, save space and
+ drop the enclosing args tuple */
+ Py_INCREF(key);
+ return key;
+ }
+ }
Py_INCREF(args);
return args;
} |
|
Date |
User |
Action |
Args |
2019-01-19 08:05:51 | rhettinger | set | recipients:
+ rhettinger, serhiy.storchaka |
2019-01-19 08:05:50 | rhettinger | set | messageid: <1547885150.33.0.728512587132.issue35780@roundup.psfhosted.org> |
2019-01-19 08:05:50 | rhettinger | link | issue35780 messages |
2019-01-19 08:05:50 | rhettinger | create | |
|