Commit 296ad89
committed
🐛 FIX: Fix
Fixes the deprecation warning from Sphinx >= 8.2:
```
RemovedInSphinx10Warning: The iter() interface for _InventoryItem objects is deprecated.
Please access the `project_name`, `project_version`, `uri`, and `displayname` attributes directly.
```
The previous code unpacked `_InventoryItem` as a tuple (`project, version, loc, text = data[target]`), which triggers the warning.
This uses `hasattr` to detect whether the new attribute-based API is available and falls back to tuple unpacking for older Sphinx versions. This approach is more robust than version checking (cf. #1079 which used `sphinx.__version_info__` — an attribute that doesn't exist; the correct attribute is `sphinx.version_info`).
Note: the correct attribute name on `_InventoryItem` is `display_name` (with underscore), despite the warning message saying `displayname`.RemovedInSphinx10Warning for inventory item iteration1 parent bb34147 commit 296ad89
1 file changed
Lines changed: 9 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
366 | 366 | | |
367 | 367 | | |
368 | 368 | | |
369 | | - | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
370 | 378 | | |
371 | 379 | | |
372 | 380 | | |
| |||
0 commit comments