Skip to content

Fix "subsection_index_toctree referenced before assignment"#1035

Merged
larsoner merged 2 commits intosphinx-gallery:masterfrom
OverLordGoldDragon:patch-1
Oct 18, 2022
Merged

Fix "subsection_index_toctree referenced before assignment"#1035
larsoner merged 2 commits intosphinx-gallery:masterfrom
OverLordGoldDragon:patch-1

Conversation

@OverLordGoldDragon
Copy link
Copy Markdown
Contributor

Produced with 'nested_sections': False:

Handler <function generate_gallery_rst at 0x0000021152A7A440> for event 'builder-inited' threw an exception 
(exception: local variable 'subsection_index_toctree' referenced before assignment)

Unsure if this reflects intent, feel free to edit.

Produced with `'nested_sections': False`:

```
Handler <function generate_gallery_rst at 0x0000021152A7A440> for event 'builder-inited' threw an exception (exception: local variable 'subsection_index_toctree' referenced before assignment)
```

Unsure if this reflects intent, feel free to edit.
@larsoner
Copy link
Copy Markdown
Contributor

@alexisthual can you look? I think this has to do with your nesting changes

@OverLordGoldDragon
Copy link
Copy Markdown
Contributor Author

OverLordGoldDragon commented Oct 18, 2022

Can this merge sometime soon? I struggle remote installing from multiple commits. I do think it's a simple bug,

if cond0:
    if cond1:
        var = 1
    print(var)

is guaranteed to fail for cond1 = False. I could add # TODO in case more code is due for some reason.

@OverLordGoldDragon
Copy link
Copy Markdown
Contributor Author

Apparently full equivalency mattered, rewrote and added doc to reflect both conds. The failure's again checksums. Also guess I'll install from fork in meantime.

@larsoner
Copy link
Copy Markdown
Contributor

Agreed this makes sense. It would be great to have a regression test, but we clearly didn't hit these lines before so I don't think the onus is on you here :)

Thanks @OverLordGoldDragon !

@larsoner larsoner merged commit 2fe8e61 into sphinx-gallery:master Oct 18, 2022
@larsoner larsoner added the bug label Oct 18, 2022
@alexisthual
Copy link
Copy Markdown
Contributor

Sorry I'm a bit late in the game here, but the fix seems ok to me!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants