Skip to content

Commit 88018c1

Browse files
committed
Removed id and unsafe_ptrs
1 parent cce3908 commit 88018c1

File tree

3 files changed

+11
-54
lines changed

3 files changed

+11
-54
lines changed

Tests/test_image_getim.py

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
from __future__ import annotations
22

3-
import pytest
4-
53
from .helper import hopper
64

75

@@ -10,10 +8,3 @@ def test_sanity() -> None:
108

119
type_repr = repr(type(im.getim()))
1210
assert "PyCapsule" in type_repr
13-
14-
with pytest.warns(DeprecationWarning, match="id property"):
15-
assert isinstance(im.im.id, int)
16-
17-
with pytest.warns(DeprecationWarning, match="unsafe_ptrs property"):
18-
ptrs = dict(im.im.unsafe_ptrs)
19-
assert ptrs.keys() == {"image8", "image32", "image"}

docs/deprecations.rst

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -122,16 +122,6 @@ The ``options`` parameter in :py:meth:`~PIL.ImageMath.lambda_eval()` and
122122
:py:meth:`~PIL.ImageMath.unsafe_eval()` has been deprecated. One or more keyword
123123
arguments can be used instead.
124124

125-
Get internal pointers to objects
126-
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
127-
128-
.. deprecated:: 11.0.0
129-
130-
``Image.core.ImagingCore.id`` and ``Image.core.ImagingCore.unsafe_ptrs`` have been
131-
deprecated and will be removed in Pillow 12 (2025-10-15). They were used for obtaining
132-
raw pointers to ``ImagingCore`` internals. To interact with C code, you can use
133-
``Image.Image.getim()``, which returns a ``Capsule`` object.
134-
135125
ExifTags.IFD.Makernote
136126
^^^^^^^^^^^^^^^^^^^^^^
137127

@@ -223,6 +213,17 @@ Specific WebP feature checks
223213
``features.check("transp_webp")``, ``features.check("webp_mux")`` and
224214
``features.check("webp_anim")`` have been removed.
225215

216+
Get internal pointers to objects
217+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
218+
219+
.. deprecated:: 11.0.0
220+
.. versionremoved:: 12.0.0
221+
222+
``Image.core.ImagingCore.id`` and ``Image.core.ImagingCore.unsafe_ptrs`` have been
223+
removed. They were used for obtaining raw pointers to ``ImagingCore`` internals. To
224+
interact with C code, you can use ``Image.Image.getim()``, which returns a ``Capsule``
225+
object.
226+
226227
TiffImagePlugin IFD_LEGACY_API
227228
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
228229

src/_imaging.c

Lines changed: 0 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -3724,18 +3724,6 @@ _getattr_bands(ImagingObject *self, void *closure) {
37243724
return PyLong_FromLong(self->image->bands);
37253725
}
37263726

3727-
static PyObject *
3728-
_getattr_id(ImagingObject *self, void *closure) {
3729-
if (PyErr_WarnEx(
3730-
PyExc_DeprecationWarning,
3731-
"id property is deprecated and will be removed in Pillow 12 (2025-10-15)",
3732-
1
3733-
) < 0) {
3734-
return NULL;
3735-
}
3736-
return PyLong_FromSsize_t((Py_ssize_t)self->image);
3737-
}
3738-
37393727
static void
37403728
_ptr_destructor(PyObject *capsule) {
37413729
PyObject *self = (PyObject *)PyCapsule_GetContext(capsule);
@@ -3750,27 +3738,6 @@ _getattr_ptr(ImagingObject *self, void *closure) {
37503738
return capsule;
37513739
}
37523740

3753-
static PyObject *
3754-
_getattr_unsafe_ptrs(ImagingObject *self, void *closure) {
3755-
if (PyErr_WarnEx(
3756-
PyExc_DeprecationWarning,
3757-
"unsafe_ptrs property is deprecated and will be removed in Pillow 12 "
3758-
"(2025-10-15)",
3759-
1
3760-
) < 0) {
3761-
return NULL;
3762-
}
3763-
return Py_BuildValue(
3764-
"(sn)(sn)(sn)",
3765-
"image8",
3766-
self->image->image8,
3767-
"image32",
3768-
self->image->image32,
3769-
"image",
3770-
self->image->image
3771-
);
3772-
}
3773-
37743741
static PyObject *
37753742
_getattr_readonly(ImagingObject *self, void *closure) {
37763743
return PyLong_FromLong(self->image->read_only);
@@ -3780,9 +3747,7 @@ static struct PyGetSetDef getsetters[] = {
37803747
{"mode", (getter)_getattr_mode},
37813748
{"size", (getter)_getattr_size},
37823749
{"bands", (getter)_getattr_bands},
3783-
{"id", (getter)_getattr_id},
37843750
{"ptr", (getter)_getattr_ptr},
3785-
{"unsafe_ptrs", (getter)_getattr_unsafe_ptrs},
37863751
{"readonly", (getter)_getattr_readonly},
37873752
{NULL}
37883753
};

0 commit comments

Comments
 (0)