Skip to content

Commit c1fb9d4

Browse files
committed
use _util.DeferredError.new everywhere
1 parent fa12c17 commit c1fb9d4

File tree

8 files changed

+17
-9
lines changed

8 files changed

+17
-9
lines changed

Tests/test_util.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ def test_deferred_error():
6666
# Arrange
6767

6868
# Act
69-
thing = _util.DeferredError(ValueError("Some error text"))
69+
thing = _util.DeferredError.new(ValueError("Some error text"))
7070

7171
# Assert
7272
with pytest.raises(ValueError):

pyproject.toml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -144,9 +144,7 @@ exclude = [
144144
'^src/PIL/DdsImagePlugin.py$',
145145
'^src/PIL/FpxImagePlugin.py$',
146146
'^src/PIL/Image.py$',
147-
'^src/PIL/ImageCms.py$',
148147
'^src/PIL/ImageFile.py$',
149-
'^src/PIL/ImageFont.py$',
150148
'^src/PIL/ImageMath.py$',
151149
'^src/PIL/ImageMorph.py$',
152150
'^src/PIL/ImageQt.py$',

src/PIL/Image.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ class DecompressionBombError(Exception):
9292
raise ImportError(msg)
9393

9494
except ImportError as v:
95-
core = DeferredError(ImportError("The _imaging C module is not installed."))
95+
core = DeferredError.new(ImportError("The _imaging C module is not installed."))
9696
# Explanations for ways that we know we might have an import error
9797
if str(v).startswith("Module use of python"):
9898
# The _imaging C module is present, but not compiled for

src/PIL/ImageCms.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
# anything in core.
2929
from ._util import DeferredError
3030

31-
_imagingcms = DeferredError(ex)
31+
_imagingcms = DeferredError.new(ex)
3232

3333
DESCRIPTION = """
3434
pyCMS

src/PIL/ImageFont.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
from enum import IntEnum
3535
from io import BytesIO
3636
from pathlib import Path
37-
from typing import IO
37+
from typing import BinaryIO
3838

3939
from . import Image
4040
from ._util import is_directory, is_path
@@ -53,7 +53,7 @@ class Layout(IntEnum):
5353
except ImportError as ex:
5454
from ._util import DeferredError
5555

56-
core = DeferredError(ex)
56+
core = DeferredError.new(ex)
5757

5858

5959
def _string_length_check(text):
@@ -191,7 +191,7 @@ class FreeTypeFont:
191191

192192
def __init__(
193193
self,
194-
font: bytes | str | Path | IO | None = None,
194+
font: bytes | str | Path | BinaryIO | None = None,
195195
size: float = 10,
196196
index: int = 0,
197197
encoding: str = "",

src/PIL/PyAccess.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
# anything in core.
4444
from ._util import DeferredError
4545

46-
FFI = ffi = DeferredError(ex)
46+
FFI = ffi = DeferredError.new(ex)
4747

4848
logger = logging.getLogger(__name__)
4949

src/PIL/_imagingcms.pyi

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
from __future__ import annotations
2+
3+
from typing import Any
4+
5+
def __getattr__(name: str) -> Any: ...

src/PIL/_imagingft.pyi

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
from __future__ import annotations
2+
3+
from typing import Any
4+
5+
def __getattr__(name: str) -> Any: ...

0 commit comments

Comments
 (0)