-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
If absent, do not try to close fp when closing image #7557
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
Changes from 1 commit
b25ece3
67e1253
5f33175
8186c63
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1014,6 +1014,21 @@ def test_fli_overrun2(self): | |
| except OSError as e: | ||
| assert str(e) == "buffer overrun when reading image file" | ||
|
|
||
| @pytest.fixture(scope="function") | ||
| def inject_caplog(self, caplog): | ||
| self._caplog = caplog | ||
|
|
||
| @pytest.mark.usefixtures("inject_caplog") | ||
| def test_close_graceful(self): | ||
| with Image.open("Tests/images/hopper.jpg") as im: | ||
| copy = im.copy() | ||
| im.close() | ||
|
||
| copy.close() | ||
|
|
||
| assert len(self._caplog.records) == 0 | ||
| assert im.fp is None | ||
| assert copy.fp is None | ||
|
|
||
|
|
||
| class MockEncoder: | ||
| pass | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.