From 85ec0a76af23222c2a4a81a40bd6a294e0862cf1 Mon Sep 17 00:00:00 2001 From: Emma Harper Smith Date: Sun, 3 Aug 2025 20:39:26 -0700 Subject: [PATCH 1/2] Fix --package-root tests for Windows 3.13 A change to relpath in 3.13 seems to have broken the handling of paths beginning with `\\`. --- mypy/fscache.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mypy/fscache.py b/mypy/fscache.py index 8251f4bd9488..e1296d1e9b35 100644 --- a/mypy/fscache.py +++ b/mypy/fscache.py @@ -117,9 +117,9 @@ def init_under_package_root(self, path: str) -> bool: if not stat.S_ISDIR(st.st_mode): return False ok = False - drive, path = os.path.splitdrive(path) # Ignore Windows drive name if os.path.isabs(path): path = os.path.relpath(path) + drive, path = os.path.splitdrive(path) # Ignore Windows drive name path = os.path.normpath(path) for root in self.package_root: if path.startswith(root): From 6c87cf83a217799cd01d8adb10fb1d4f73b38c03 Mon Sep 17 00:00:00 2001 From: Emma Harper Smith Date: Sun, 3 Aug 2025 20:46:42 -0700 Subject: [PATCH 2/2] Slightly different approach --- mypy/fscache.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/mypy/fscache.py b/mypy/fscache.py index e1296d1e9b35..240370159fff 100644 --- a/mypy/fscache.py +++ b/mypy/fscache.py @@ -117,9 +117,14 @@ def init_under_package_root(self, path: str) -> bool: if not stat.S_ISDIR(st.st_mode): return False ok = False + + # skip if on a different drive + current_drive, _ = os.path.splitdrive(os.getcwd()) + drive, _ = os.path.splitdrive(path) + if drive != current_drive: + return False if os.path.isabs(path): path = os.path.relpath(path) - drive, path = os.path.splitdrive(path) # Ignore Windows drive name path = os.path.normpath(path) for root in self.package_root: if path.startswith(root):