Skip to content

Ensure duplicated file pointer is closed#5946

Merged
hugovk merged 1 commit intopython-pillow:mainfrom
radarhere:file_pointer
Jan 10, 2022
Merged

Ensure duplicated file pointer is closed#5946
hugovk merged 1 commit intopython-pillow:mainfrom
radarhere:file_pointer

Conversation

@radarhere
Copy link
Copy Markdown
Member

Resolves #5936. Ensures that the file pointer duplicated in TiffImagePlugin is closed, rather than counting on libtiff to do it.

# libtiff closes the file descriptor, so pass in a dup.
try:
fp = hasattr(self.fp, "fileno") and os.dup(self.fp.fileno())

I haven't added a test for this, since the issue involves hitting the limit on the number of open files.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

OSError: [Errno 24] Too many open files for image.save for tiff images

2 participants