Skip to content

Fix list_index variable shadowing in fix_incorrect_toc - #167

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

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

Conversation

@BukeLy

@BukeLy BukeLy commented Mar 16, 2026

Copy link
Copy Markdown
Member

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>
martindecz pushed a commit to martindecz/PageIndex that referenced this pull request Apr 11, 2026
…ectifyAI#167)

Rename loop variable list_index -> page_list_idx to prevent overwriting
outer list_index = incorrect_item['list_index'], which caused results
to be written back to wrong index positions.

Cherry-picked from VectifyAI/PageIndex@85f17f9

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
suulkyy pushed a commit to suulkyy/PageIndex that referenced this pull request May 8, 2026
Fix list_index variable shadowing in fix_incorrect_toc
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