浏览代码

Refs #29942 -- Fixed docs build on Python < 3.9 avoiding dict union operator.

The docs build process was failing on djangoproject.com since it uses Python 3.8 and the dict union operator was added in Python 3.9.
David Smith 10 月之前
父节点
当前提交
15fff62d5d
共有 1 个文件被更改,包括 4 次插入4 次删除
  1. 4 4
      docs/_ext/github_links.py

+ 4 - 4
docs/_ext/github_links.py

@@ -41,10 +41,10 @@ class CodeLocator(ast.NodeVisitor):
                 file = module_name_to_file_path(node.module)
                 file_contents = file.read_text(encoding="utf-8")
                 locator = CodeLocator.from_code(file_contents)
-                self.import_locations |= locator.import_locations
-                self.import_locations |= {
-                    n: node.module for n in locator.node_line_numbers if "." not in n
-                }
+                self.import_locations.update(locator.import_locations)
+                self.import_locations.update(
+                    {n: node.module for n in locator.node_line_numbers if "." not in n}
+                )
             else:
                 self.import_locations[alias.name] = ("." * node.level) + (
                     node.module or ""