From: Michael Fladischer <FladischerMichael@fladi.at>
Date: Fri, 6 Jan 2023 20:59:33 +0000
Subject: Make intersphinx use local copies of objects.inv files.

---
 docs/conf.py | 18 +++++++++++++++---
 1 file changed, 15 insertions(+), 3 deletions(-)

diff --git a/docs/conf.py b/docs/conf.py
index f8efc6b..68a232f 100644
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -14,6 +14,8 @@
 # If extensions (or modules to document with autodoc) are in another directory,
 # add these directories to sys.path here. If the directory is relative to the
 # documentation root, use os.path.abspath to make it absolute, like shown here.
+import os
+import sys
 from pkg_resources import get_distribution
 
 # -- General configuration ------------------------------------------------
@@ -305,9 +307,19 @@ texinfo_documents = [
 
 # -- Intersphinx configuration ------------------------------------------------
 
-intersphinx_mapping = {
-    "python": ("https://docs.python.org/3.8", None),
-}
+def check_object_path(key, url, path):
+    if os.path.isfile(path):
+        return {key: (url, path)}
+    return {}
+
+intersphinx_mapping = {}
+intersphinx_mapping.update(
+    check_object_path(
+        'python',
+        'https://docs.python.org/',
+        '/usr/share/doc/python' + '.'.join([str(x) for x in sys.version_info[0:2]]) + '/html/objects.inv'
+    )
+)
 
 # -- Doctest configuration ----------------------------------------
 
