3 ms·
A cache without any eviction! Probably should not expose `fnmatch` to the network where the pattern varies.
by bluetech 9y ago
A cache without any eviction! Probably should not expose `fnmatch` to the network where the pattern varies.
- dom0 9y agoThe RE engine here is only used as a fast VM; so the pathological cases from the article should still apply. So apart from the memory use issues there's also that.
- orf 9y agoIt should be updated with a functools.lru_cache decorator I think.
- benhoyt 9y agoThat's an old version of Python source from a mirror. It uses functools.lru_cache with a maxsize of 256 now: https://github.com/python/cpython/blob/fcfe80ec2592fed8b3941c79056a8737abef7d3b/Lib/fnmatch.py#L38 https://github.com/python/cpython/blob/fcfe80ec2592fed8b3941...
- js2 9y agoGah, thanks for the proper link. I should've double checked (and realized it since no updates in 8 years is unlikely).