From 7a39a30e1cc63c423d7c91d1f5f61720f009109c Mon Sep 17 00:00:00 2001 From: James Knight Date: Sun, 24 Jul 2022 13:42:20 -0400 Subject: [PATCH] do not pass env argument into deprecated builders Changes to the builder to move towards passing an environment into the builder [1] can cause some legacy builder types to fail to load [2]. For example: Traceback (most recent call last): File "/home/runner/work/confluencebuilder/confluencebuilder/.tox/py38-sphinx51/lib/python3.8/site-packages/sphinx/registry.py", line 162, in create_builder return self.builders[name](app, env) TypeError: __init__() takes 2 positional arguments but 3 were given The fallback case for preparing deprecated builders should avoid setting `env`. [1]: 6ef22d261303ec07890305b300135c34952ca327 [2]: https://github.com/sphinx-contrib/confluencebuilder/pull/691 Signed-off-by: James Knight --- sphinx/registry.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sphinx/registry.py b/sphinx/registry.py index 561fba69b74..b4893e02cfd 100644 --- a/sphinx/registry.py +++ b/sphinx/registry.py @@ -166,7 +166,7 @@ def create_builder(self, app: "Sphinx", name: str, f"'env'argument. Report this bug to the developers of your custom builder, " f"this is likely not a issue with Sphinx. The 'env' argument will be required " f"from Sphinx 7.", RemovedInSphinx70Warning, stacklevel=2) - builder = self.builders[name](app, env=...) # type: ignore[arg-type] + builder = self.builders[name](app) if env is not None: builder.set_environment(env) return builder