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

Issue with doc.close() not closing the document in PyMuPDF #3039

Closed
albeiroep opened this issue Jan 15, 2024 · 2 comments
Closed

Issue with doc.close() not closing the document in PyMuPDF #3039

albeiroep opened this issue Jan 15, 2024 · 2 comments
Labels
fix developed release schedule to be determined

Comments

@albeiroep
Copy link

albeiroep commented Jan 15, 2024

Description of the bug

Hello PyMuPDF community,

I am encountering an issue with PyMuPDF where a PDF file, once opened using fitz.open, does not close properly even after calling doc.close(). This is causing my Python script to not terminate as expected.

Steps to Reproduce:

  1. Open a PDF file using PyMuPDF: doc = fitz.open(pdf_path)
  2. Attempt to close the document: doc.close()
  3. Check if the document is closed: print(doc.is_closed)

Expected Behavior:
The doc.is_closed should return True after calling doc.close().

Actual Behavior:
The doc.is_closed returns False, indicating that the document remains open. As a result, my Python script does not terminate properly.

Environment:

  • PyMuPDF version: (1.23.13)
  • Python version: (e.g., Python 3.11)
  • Operating System: (e.g., Lubuntu 23.04)

Additional Information:

  • I am using the latest version of PyMuPDF. I have even tried installing directly from the GitHub repository to ensure I have the most recent updates.
  • I am aware that this issue was addressed in previous versions of PyMuPDF, but it seems to have resurfaced.

Any assistance in resolving this issue would be greatly appreciated. Thank you in advance for your help.

How to reproduce the bug

The bug can be reproduced following the code i have provided in my main message

PyMuPDF version

Built from source

Operating system

Linux

Python version

3.11

@julian-smith-artifex-com
Copy link
Collaborator

Thanks for the report, we have a fix.

@julian-smith-artifex-com julian-smith-artifex-com added the fix developed release schedule to be determined label Jan 15, 2024
julian-smith-artifex-com added a commit that referenced this issue Jan 15, 2024
Added a test of this to tests/test_general.py:test_bug1971().

This addresses #3039.
julian-smith-artifex-com added a commit that referenced this issue Jan 15, 2024
Added a test of this to tests/test_general.py:test_bug1971().

This addresses #3039.
@julian-smith-artifex-com
Copy link
Collaborator

Fixed in 1.23.14.

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

No branches or pull requests

2 participants