From f51a50478c0de482564f78cc7c2f1eb697c20c7e Mon Sep 17 00:00:00 2001 From: Kyle Sunden Date: Mon, 5 Dec 2022 13:26:00 -0600 Subject: [PATCH] Backport PR #24592: DOC: Don't try to link paths that are on a different drive --- doc/conf.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/doc/conf.py b/doc/conf.py index 55cabd84d1c7..9a46f513dea1 100644 --- a/doc/conf.py +++ b/doc/conf.py @@ -662,7 +662,10 @@ def linkcode_resolve(domain, info): if lineno else "") startdir = Path(matplotlib.__file__).parent.parent - fn = os.path.relpath(fn, start=startdir).replace(os.path.sep, '/') + try: + fn = os.path.relpath(fn, start=startdir).replace(os.path.sep, '/') + except ValueError: + return None if not fn.startswith(('matplotlib/', 'mpl_toolkits/')): return None