Open
Description
Description
sphinx autoenum does not work with Sphinx 7.2+.
We get:
updating environment: [new config] 1 added, 0 changed, 0 removed
/Users/adam/.virtualenvs/enum_example/lib/python3.11/site-packages/enum_tools/autoenum.py:226: RemovedInSphinx80Warning: The tuple interface of ObjectMember is deprecated. Use (obj.__name__, obj.object) instead.
if member[0] not in self.object.__members__.keys():
Exception occurred:
File "/Users/adam/.virtualenvs/enum_example/lib/python3.11/site-packages/sphinx/ext/autodoc/__init__.py", line 779, in filter_members
self.name, membername, member, exc, type='autodoc')
^^^^^^^^^^
UnboundLocalError: cannot access local variable 'membername' where it is not associated with a value
The full traceback has been saved in /var/folders/kd/d94l0l2j6vs_5f52qthyrtj80000gn/T/sphinx-err-040l0gvj.log, if you want to report the issue to the developers.
Steps to Reproduce
pip
install the following:
enum-tools==0.10.0
# This will cause a failure.
# Change this to 7.1.2 or lower to avoid the error.
sphinx==7.2.2
Create the following files:
conf.py
:
extensions = ['sphinx.ext.autodoc', 'enum_tools.autoenum']
index.rst
:
.. autoenum:: enum_tools.demo.People
:members:
Run:
sphinx-build -M html . build
Actual result:
updating environment: [new config] 1 added, 0 changed, 0 removed
/Users/adam/.virtualenvs/enum_example/lib/python3.11/site-packages/enum_tools/autoenum.py:226: RemovedInSphinx80Warning: The tuple interface of ObjectMember is deprecated. Use (obj.__name__, obj.object) instead.
if member[0] not in self.object.__members__.keys():
Exception occurred:
File "/Users/adam/.virtualenvs/enum_example/lib/python3.11/site-packages/sphinx/ext/autodoc/__init__.py", line 779, in filter_members
self.name, membername, member, exc, type='autodoc')
^^^^^^^^^^
UnboundLocalError: cannot access local variable 'membername' where it is not associated with a value
The full traceback has been saved in /var/folders/kd/d94l0l2j6vs_5f52qthyrtj80000gn/T/sphinx-err-040l0gvj.log, if you want to report the issue to the developers.
Expected result:
No error.
Reproduces how often:
Easily reproduced.
Version
- Operating System: macOS
- Python: 3.11.4
- enum_tools: 0.10.0
Installation source
pip