Conversation
|
One correctness issue:
(authored by codex) |
feb5016 to
819e758
Compare
|
Addressed the paragraph-level terminal |
|
One production-readiness issue remains:
(authored by codex) |
|
Moved this fix to the next release version in f31f962: |
Summary
This pull request fixes #3592 by replacing per-section
Section.iter_inner_content()calls with a single document-body traversal. Section boundaries are detected at paragraph-levelsectPrelements so page breaks, headers, body content, and footers retain their existing order.On the current main branch with python-docx 1.2.0, traversing synthetic documents with 20 paragraphs per section took:
With this change, the isolated traversal path took 0.008s, 0.010s, and 0.024s respectively. The full partition pipeline still includes text classification and metadata work; these numbers intentionally isolate the repeated section-prefix scan fixed here.
Tests
uv run --no-sync pytest -q test_unstructured/partition/test_docx.py(79 passed)uv run --no-sync ruff check .uv run --no-sync ruff format --check .git diff --checkSection.iter_inner_content()is called.make test-extra-docxadditionally ran 96 tests successfully, while 6 legacy.docconversion tests failed because the local LibreOffice process did not produce the requested.docxfiles. The complete DOCX test module passes independently.