Skip to content

Commit 1800e58

Browse files
committed
Removed ImageFile raise_oserror()
1 parent 5d4a054 commit 1800e58

File tree

3 files changed

+10
-26
lines changed

3 files changed

+10
-26
lines changed

Tests/test_imagefile.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -151,11 +151,6 @@ def read(self, size: int | None = None) -> bytes:
151151
# Despite multiple tiles, assert only one tile caused a read of maxblock size
152152
assert reads.count(im.decodermaxblock) == 1
153153

154-
def test_raise_oserror(self) -> None:
155-
with pytest.warns(DeprecationWarning, match="raise_oserror"):
156-
with pytest.raises(OSError):
157-
ImageFile.raise_oserror(1)
158-
159154
def test_raise_typeerror(self) -> None:
160155
with pytest.raises(TypeError):
161156
parser = ImageFile.Parser()

docs/deprecations.rst

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,6 @@ Deprecated features
1212
Below are features which are considered deprecated. Where appropriate,
1313
a :py:exc:`DeprecationWarning` is issued.
1414

15-
ImageFile.raise_oserror
16-
~~~~~~~~~~~~~~~~~~~~~~~
17-
18-
.. deprecated:: 10.2.0
19-
20-
``ImageFile.raise_oserror()`` has been deprecated and will be removed in Pillow
21-
12.0.0 (2025-10-15). The function is undocumented and is only useful for translating
22-
error codes returned by a codec's ``decode()`` method, which ImageFile already does
23-
automatically.
24-
2515
IptcImageFile helper functions
2616
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2717

@@ -206,6 +196,16 @@ Removed features
206196
Deprecated features are only removed in major releases after an appropriate
207197
period of deprecation has passed.
208198

199+
ImageFile.raise_oserror
200+
~~~~~~~~~~~~~~~~~~~~~~~
201+
202+
.. deprecated:: 10.2.0
203+
.. versionremoved:: 12.0.0
204+
205+
``ImageFile.raise_oserror()`` has been removed. The function was undocumented and was
206+
only useful for translating error codes returned by a codec's ``decode()`` method,
207+
which ImageFile already did automatically.
208+
209209
BGR;15, BGR 16 and BGR;24
210210
^^^^^^^^^^^^^^^^^^^^^^^^^
211211

src/PIL/ImageFile.py

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@
3737
from typing import IO, Any, NamedTuple, cast
3838

3939
from . import ExifTags, Image
40-
from ._deprecate import deprecate
4140
from ._util import DeferredError, is_path
4241

4342
TYPE_CHECKING = False
@@ -83,16 +82,6 @@ def _get_oserror(error: int, *, encoder: bool) -> OSError:
8382
return OSError(msg)
8483

8584

86-
def raise_oserror(error: int) -> OSError:
87-
deprecate(
88-
"raise_oserror",
89-
12,
90-
action="It is only useful for translating error codes returned by a codec's "
91-
"decode() method, which ImageFile already does automatically.",
92-
)
93-
raise _get_oserror(error, encoder=False)
94-
95-
9685
def _tilesort(t: _Tile) -> int:
9786
# sort on offset
9887
return t[2]

0 commit comments

Comments
 (0)