Skip to content

Commit

Permalink
do not pass env argument into deprecated builders
Browse files Browse the repository at this point in the history
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]: 6ef22d2
[2]: sphinx-contrib/confluencebuilder#691

Signed-off-by: James Knight <james.d.knight@live.com>
  • Loading branch information
jdknight committed Jul 24, 2022
1 parent cc1f6cb commit 7a39a30
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion sphinx/registry.py
Expand Up @@ -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
Expand Down

0 comments on commit 7a39a30

Please sign in to comment.