diff --git a/Tests/test_image_getim.py b/Tests/test_image_getim.py index 7b5f7a589..07612e587 100644 --- a/Tests/test_image_getim.py +++ b/Tests/test_image_getim.py @@ -1,7 +1,5 @@ from __future__ import annotations -import pytest - from .helper import hopper @@ -10,10 +8,3 @@ def test_sanity() -> None: type_repr = repr(type(im.getim())) assert "PyCapsule" in type_repr - - with pytest.warns(DeprecationWarning, match="id property"): - assert isinstance(im.im.id, int) - - with pytest.warns(DeprecationWarning, match="unsafe_ptrs property"): - ptrs = dict(im.im.unsafe_ptrs) - assert ptrs.keys() == {"image8", "image32", "image"} diff --git a/docs/deprecations.rst b/docs/deprecations.rst index 78c6f1092..3225b6d52 100644 --- a/docs/deprecations.rst +++ b/docs/deprecations.rst @@ -122,16 +122,6 @@ The ``options`` parameter in :py:meth:`~PIL.ImageMath.lambda_eval()` and :py:meth:`~PIL.ImageMath.unsafe_eval()` has been deprecated. One or more keyword arguments can be used instead. -Get internal pointers to objects -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -.. deprecated:: 11.0.0 - -``Image.core.ImagingCore.id`` and ``Image.core.ImagingCore.unsafe_ptrs`` have been -deprecated and will be removed in Pillow 12 (2025-10-15). They were used for obtaining -raw pointers to ``ImagingCore`` internals. To interact with C code, you can use -``Image.Image.getim()``, which returns a ``Capsule`` object. - ExifTags.IFD.Makernote ^^^^^^^^^^^^^^^^^^^^^^ @@ -223,6 +213,17 @@ Specific WebP feature checks ``features.check("transp_webp")``, ``features.check("webp_mux")`` and ``features.check("webp_anim")`` have been removed. +Get internal pointers to objects +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +.. deprecated:: 11.0.0 +.. versionremoved:: 12.0.0 + +``Image.core.ImagingCore.id`` and ``Image.core.ImagingCore.unsafe_ptrs`` have been +removed. They were used for obtaining raw pointers to ``ImagingCore`` internals. To +interact with C code, you can use ``Image.Image.getim()``, which returns a ``Capsule`` +object. + TiffImagePlugin IFD_LEGACY_API ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/src/_imaging.c b/src/_imaging.c index 7cc1fb1a4..8ba2a2908 100644 --- a/src/_imaging.c +++ b/src/_imaging.c @@ -3724,18 +3724,6 @@ _getattr_bands(ImagingObject *self, void *closure) { return PyLong_FromLong(self->image->bands); } -static PyObject * -_getattr_id(ImagingObject *self, void *closure) { - if (PyErr_WarnEx( - PyExc_DeprecationWarning, - "id property is deprecated and will be removed in Pillow 12 (2025-10-15)", - 1 - ) < 0) { - return NULL; - } - return PyLong_FromSsize_t((Py_ssize_t)self->image); -} - static void _ptr_destructor(PyObject *capsule) { PyObject *self = (PyObject *)PyCapsule_GetContext(capsule); @@ -3750,27 +3738,6 @@ _getattr_ptr(ImagingObject *self, void *closure) { return capsule; } -static PyObject * -_getattr_unsafe_ptrs(ImagingObject *self, void *closure) { - if (PyErr_WarnEx( - PyExc_DeprecationWarning, - "unsafe_ptrs property is deprecated and will be removed in Pillow 12 " - "(2025-10-15)", - 1 - ) < 0) { - return NULL; - } - return Py_BuildValue( - "(sn)(sn)(sn)", - "image8", - self->image->image8, - "image32", - self->image->image32, - "image", - self->image->image - ); -} - static PyObject * _getattr_readonly(ImagingObject *self, void *closure) { return PyLong_FromLong(self->image->read_only); @@ -3780,9 +3747,7 @@ static struct PyGetSetDef getsetters[] = { {"mode", (getter)_getattr_mode}, {"size", (getter)_getattr_size}, {"bands", (getter)_getattr_bands}, - {"id", (getter)_getattr_id}, {"ptr", (getter)_getattr_ptr}, - {"unsafe_ptrs", (getter)_getattr_unsafe_ptrs}, {"readonly", (getter)_getattr_readonly}, {NULL} };