-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Closed
Milestone
Description
This is specific to 3.4.0
Autosummary may fail on a global variable whose value is an object with an __eq__ implementation that raises an error.
Example
For example, let's say I have a module that looks like this:
class Foo:
def __eq__(self, other):
if not isinstance(other, Foo):
raise TypeError('Foo objects cannot be compared to non-Foo objects')
foo = Foo()
- There is a global variable
foo - Its value is an object whose
__eq__behavior is strict, and may raise an error
When running Sphinx, autosummary will fail.
...
reading sources... [100%] generated/mymodule.foo
Exception occurred:
File "/root/sphinx-eq-bug-repro/mymodule/__init__.py", line 4, in __eq__
raise TypeError('Foo objects cannot be compared to non-Foo objects')
TypeError: Foo objects cannot be compared to non-Foo objects
(This code example is a little contrived but hopefully it illustrates well enough—it's a very simplified version of our actual use case)
To Reproduce
I have a minimal repro here: https://github.com/timothydijamco/sphinx-eq-bug-repro
Running the below will hit the error if using Sphinx 3.4.0 (but not with Sphinx 3.3.1).
$ git clone https://github.com/timothydijamco/sphinx-eq-bug-repro.git
$ cd sphinx-eq-bug-repro
$ cd docs
$ make html
Expected behavior
Sphinx should finish building successfully (it builds OK when using 3.3.1).
Environment info
- Python version: 3.9.0
- Sphinx version: 3.4.0
- Sphinx extensions: sphinx.ext.autosummary
Reactions are currently unavailable