Skip to content

Commit 9845500

Browse files
jdknightAA-Turner
andauthored
Improve support for deprecated builders without env arg (#10702)
Co-authored-by: Adam Turner <[email protected]>
1 parent cc1f6cb commit 9845500

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

sphinx/builders/__init__.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,10 +89,11 @@ def __init__(self, app: "Sphinx", env: BuildEnvironment = None) -> None:
8989
self.env: BuildEnvironment = env
9090
self.env.set_versioning_method(self.versioning_method,
9191
self.versioning_compare)
92-
elif env is not Ellipsis:
92+
else:
9393
# ... is passed by SphinxComponentRegistry.create_builder to not show two warnings.
9494
warnings.warn("The 'env' argument to Builder will be required from Sphinx 7.",
9595
RemovedInSphinx70Warning, stacklevel=2)
96+
self.env = None
9697
self.events: EventManager = app.events
9798
self.config: Config = app.config
9899
self.tags: Tags = app.tags

sphinx/registry.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ def create_builder(self, app: "Sphinx", name: str,
166166
f"'env'argument. Report this bug to the developers of your custom builder, "
167167
f"this is likely not a issue with Sphinx. The 'env' argument will be required "
168168
f"from Sphinx 7.", RemovedInSphinx70Warning, stacklevel=2)
169-
builder = self.builders[name](app, env=...) # type: ignore[arg-type]
169+
builder = self.builders[name](app)
170170
if env is not None:
171171
builder.set_environment(env)
172172
return builder

0 commit comments

Comments
 (0)