Skip to content

Commit 52a7a80

Browse files
committed
Remove python_version mypy configuration; fix issues arising on 3.11-3.14
1 parent 9b1659a commit 52a7a80

4 files changed

Lines changed: 6 additions & 17 deletions

File tree

Tests/conftest.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
gil_enabled_at_start = True
1212
if FREE_THREADED_BUILD:
13-
gil_enabled_at_start = sys._is_gil_enabled() # type: ignore[attr-defined]
13+
gil_enabled_at_start = sys._is_gil_enabled() # type: ignore[attr-defined,unused-ignore]
1414

1515

1616
def pytest_report_header(config: pytest.Config) -> str:
@@ -28,7 +28,7 @@ def pytest_terminal_summary(terminalreporter: pytest.TerminalReporter) -> None:
2828
if (
2929
FREE_THREADED_BUILD
3030
and not gil_enabled_at_start
31-
and sys._is_gil_enabled() # type: ignore[attr-defined]
31+
and sys._is_gil_enabled() # type: ignore[attr-defined,unused-ignore]
3232
):
3333
tr = terminalreporter
3434
tr.ensure_newline()

Tests/test_image.py

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
import warnings
1010
from pathlib import Path
1111
from types import ModuleType
12-
from typing import IO, Any
12+
from typing import IO
1313

1414
import pytest
1515

@@ -197,17 +197,6 @@ def test_fp_name(self, tmp_path: Path) -> None:
197197
class FP(io.BytesIO):
198198
name: Path
199199

200-
if sys.version_info >= (3, 12):
201-
from collections.abc import Buffer
202-
203-
def write(self, data: Buffer) -> int:
204-
return len(data)
205-
206-
else:
207-
208-
def write(self, data: Any) -> int:
209-
return len(data)
210-
211200
fp = FP()
212201
fp.name = temp_file
213202

pyproject.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,6 @@ lint.isort.required-imports = [
187187
max_supported_python = "3.15"
188188

189189
[tool.mypy]
190-
python_version = "3.11"
191190
disallow_subclassing_any = false
192191
disallow_untyped_calls = false
193192
warn_return_any = false

src/PIL/GifImagePlugin.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1195,8 +1195,9 @@ class Collector(BytesIO):
11951195
data = []
11961196

11971197
def write(self, data: Buffer) -> int:
1198-
self.data.append(data)
1199-
return len(data)
1198+
data_bytes = bytes(data)
1199+
self.data.append(data_bytes)
1200+
return len(data_bytes)
12001201

12011202
im.load() # make sure raster data is available
12021203

0 commit comments

Comments
 (0)