Skip to content

Fix list_index variable shadowing in fix_incorrect_toc#167

Merged
BukeLy merged 1 commit intomainfrom
fix/list-index-shadowing
Mar 16, 2026
Merged

Fix list_index variable shadowing in fix_incorrect_toc#167
BukeLy merged 1 commit intomainfrom
fix/list-index-shadowing

Conversation

@BukeLy
Copy link
Copy Markdown
Collaborator

@BukeLy BukeLy commented Mar 16, 2026

Summary

  • Rename loop variable list_index to page_list_idx in fix_incorrect_toc to avoid shadowing the outer list_index = incorrect_item['list_index'], which caused results to be written back to wrong index positions.

Closes #66

The loop variable `list_index = page_index - start_index` was
overwriting the outer `list_index = incorrect_item['list_index']`,
causing results to be written back to wrong index positions.

Rename the loop variable to `page_list_idx` to avoid shadowing.

Closes #66
@BukeLy BukeLy merged commit 4b4b20f into main Mar 16, 2026
@BukeLy BukeLy deleted the fix/list-index-shadowing branch March 16, 2026 06:20
martindecz pushed a commit to martindecz/PageIndex that referenced this pull request Mar 29, 2026
- Upstream main (28542de) — latest VectifyAI/PageIndex
- PR VectifyAI#188: fix prevent KeyError crash and context exhaustion in TOC processing
- Fix list_index shadowing (VectifyAI#167) already in upstream
- LiteLLM integration (VectifyAI#168) already in upstream

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix: prevent list_index variable shadowing in fix_incorrect_toc

1 participant