Skip to content

Commit bf18e5f

Browse files
committed
Assert fp is not None
1 parent 476b122 commit bf18e5f

2 files changed

Lines changed: 2 additions & 0 deletions

File tree

Tests/test_file_cur.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ def test_invalid_file() -> None:
2626
no_cursors_file = "Tests/images/no_cursors.cur"
2727

2828
cur = CurImagePlugin.CurImageFile(TEST_FILE)
29+
assert cur.fp is not None
2930
cur.fp.close()
3031
with open(no_cursors_file, "rb") as cur.fp:
3132
with pytest.raises(TypeError):

src/PIL/CurImagePlugin.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ class CurImageFile(BmpImagePlugin.BmpImageFile):
3838
format_description = "Windows Cursor"
3939

4040
def _open(self) -> None:
41+
assert self.fp is not None
4142
offset = self.fp.tell()
4243

4344
# check magic

0 commit comments

Comments
 (0)