[issue14373] C implementation of functools.lru_cache

Alexey Kachayev report at bugs.python.org
Sun Dec 30 21:04:12 CET 2012


Alexey Kachayev added the comment:

Updated diff with:
 * fix object leaks
 * tp_clear
 * additional test for maxsize < 0

I also reimplemented multithreading test (fixed error and added skip rule). But actually, I'm not sure that it's enough for ensuring thread-safety of clear operation. I'm working on other variant now. I will be appreciated for any advice about where to find example of the same (or close enough) test cases from other modules.

Regarding to previous comments from review. 

1. "guard against negative numbers"

I added special test case for negative maxsize in order to show, that now C version works the same as Python one. So, should we change both implementation? What behavior is most logical here? Reimplementation will change public API, so it's not only about acceleration.

2. Use regular PyObject instead of lru_list_elem.

What the problems are with current implementation?

----------
Added file: http://bugs.python.org/file28498/14373.v9.diff

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue14373>
_______________________________________


More information about the Python-bugs-list mailing list