Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PyMuPDF hangs when iterating over zero page PDF pages backwards #4018

Open
C-Saunders opened this issue Nov 4, 2024 · 1 comment
Open

PyMuPDF hangs when iterating over zero page PDF pages backwards #4018

C-Saunders opened this issue Nov 4, 2024 · 1 comment
Labels
bug fix developed release schedule to be determined

Comments

@C-Saunders
Copy link

Description of the bug

PyMuPDF is able to open this PDF, but hangs if I try to iterate over the pages backwards.

How to reproduce the bug

zero_pages.pdf

import pymupdf

pdf = pymupdf.open("...zero_pages.pdf")

# this raises ValueError: bad start page number
for page in pdf.pages():
    print(page.number)

# this hangs forever
for page in pdf.pages(-1, -1):
    print(page.number)

I've tried this on Mac and Linux, and with PyMuPDF versions 1.24.9 and 1.24.13

PyMuPDF version

1.24.13

Operating system

MacOS

Python version

3.11

@C-Saunders C-Saunders changed the title PyMuPDF hangs when iterating over zero page PDFs backwards PyMuPDF hangs when iterating over zero page PDF pages backwards Nov 4, 2024
@JorjMcKie JorjMcKie added bug fix developed release schedule to be determined labels Nov 4, 2024
@JorjMcKie
Copy link
Collaborator

Trivial change fixes this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug fix developed release schedule to be determined
Projects
None yet
Development

No branches or pull requests

2 participants