sphinx-doc / sphinx-doc/sphinx

inline_all_toctrees() contains a non-specific except block that masks other issues.

Open
#5,138 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

api type:proposal
Dominant language
Python
Stars
8k
Forks
2.6k
PR merge metrics
No merged PRs in 30d

Description

Problem

I'm using an extension that fails when using singlehtml, raising an exception during util/nodes.py:inline_all_toctrees(). The extension's node class doesn't play nice with _new_copy(), apparently. The exception is caught by the bare except Exception: line in util/nodes.py:inline_all_toctrees(), emitting a warning that a referenced document does not exist, even though the document does exist and the error is something else entirely.

Expected results

I think ideally this except block would only trigger on Exceptions that actually result from nonexistent files, letting all other exceptions bubble up.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in util/nodes.py at inline_all_toctrees() and reproduce the singlehtml failure with the extension's node class and _new_copy(). Trace which exception produces the nonexistent-document warning, then verify that only missing-document cases emit it while unrelated extension errors bubble up.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
documentation
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.