summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRyan Shepherd <ryansh@microsoft.com>2023-03-23 14:26:17 -0700
committerStéphane Bidoul <stephane.bidoul@gmail.com>2023-04-10 16:45:34 +0200
commit14736eac9c47d9ad30a79dfa60b1bc7dce4feb36 (patch)
treec01959f9b44cf9ba92f89aa0e86ca8be003f93c3 /src
parent6a8e403148be555cda5046932eadfed4dde2b035 (diff)
downloadpip-14736eac9c47d9ad30a79dfa60b1bc7dce4feb36.tar.gz
Document _normalize_path_cached
Diffstat (limited to 'src')
-rw-r--r--src/pip/_internal/req/req_uninstall.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/pip/_internal/req/req_uninstall.py b/src/pip/_internal/req/req_uninstall.py
index 018e011d5..34d02ccaf 100644
--- a/src/pip/_internal/req/req_uninstall.py
+++ b/src/pip/_internal/req/req_uninstall.py
@@ -313,6 +313,9 @@ class UninstallPathSet:
self._pth: Dict[str, UninstallPthEntries] = {}
self._dist = dist
self._moved_paths = StashedUninstallPathSet()
+ # Create local cache of normalize_path results. Creating an UninstallPathSet
+ # can result in hundreds/thousands of redundant calls to normalize_path with the same
+ # args, which hurts performance.
self._normalize_path_cached = functools.lru_cache(maxsize=256)(normalize_path)
def _permitted(self, path: str) -> bool: