Skip to content

Fix keyword forwarding in single-process page extraction - #5206

Open
JackyHsu-X wants to merge 1 commit into
pymupdf:mainfrom
JackyHsu-X:fix/apply-pages-keyword-arguments
Open

JackyHsu-X wants to merge 1 commit into
pymupdf:mainfrom
JackyHsu-X:fix/apply-pages-keyword-arguments

Conversation

@JackyHsu-X

Copy link
Copy Markdown

apply_pages(method="single") passes initfn_kwargs to the page callback instead of pagefn_kwargs. This can raise an unexpected-keyword error when an initializer has its own arguments, and it makes top-level get_text() silently ignore options such as option="dict", clip, and sort=True.

Pass the documented pagefn_kwargs, matching the multiprocessing path. Add real-PDF regressions for separate initializer/callback arguments and for extraction options in both single-process and multiprocessing modes, including non-contiguous page selection.

Found through source inspection and reproduced locally. This is separate from the completed page-selection fix #4524 and the fork-page-index change in open #5076.

Validation on Windows / Python 3.13.15:

  • New cases against original production code: 8 failed, 4 passed (the four multiprocessing controls pass).
  • Complete tests/test_textextract.py: 37 passed with the fix.
  • Official Pylint and Flake8 test functions passed; changed-file compilation and diff checks passed.

The checkout's Python sources were tested using the native bindings from the official PyMuPDF 2.0 wheel (MuPDF 1.28.5). Native extensions were not rebuilt; the full repository suite and other platforms were not run.

AI assistance: OpenAI Codex investigated the defect, prepared the patch and regression tests, ran the checks, and self-reviewed the diff. No separate human code review is claimed.

@github-actions

Copy link
Copy Markdown
Contributor


Thank you for your submission, we really appreciate it. Like many open-source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution. You can sign the CLA by just posting a Pull Request Comment same as the below format.


I have read the CLA Document and I hereby sign the CLA


You can retrigger this bot by commenting recheck in this Pull Request. Posted by the CLA Assistant Lite bot.

@JackyHsu-X

Copy link
Copy Markdown
Author

I have read the CLA Document and I hereby sign the CLA

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.

fitz.get_text ignores 'pages' kwarg

1 participant