Skip to content

Commit bf11639

Browse files
committed
rename PyCapsule -> Capsule
1 parent 147f75e commit bf11639

File tree

5 files changed

+10
-28
lines changed

5 files changed

+10
-28
lines changed

docs/deprecations.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ Get Internal Pointers to Objects
144144
``Image.core.ImageCore.id`` and ``Image.core.ImageCore.unsafe_ptrs``
145145
have been deprecated and will be removed in Pillow 12 (2025-10-15).
146146
They were used for obtaining raw pointers to ``ImageCore`` internals. To interact with
147-
C code, you can use ``Image.core.ImageCore.ptr``, which returns a ``PyCapsule`` object.
147+
C code, you can use ``Image.core.ImageCore.ptr``, which returns a ``Capsule`` object.
148148

149149
Removed features
150150
----------------

src/Tk/tkImaging.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,9 +79,7 @@ ImagingFind(const char *name) {
7979
}
8080

8181
if (!PyCapsule_IsValid(capsule, IMAGING_MAGIC)) {
82-
PyErr_Format(
83-
PyExc_TypeError, "Expected PyCapsule with '%s' name.", IMAGING_MAGIC
84-
);
82+
PyErr_Format(PyExc_TypeError, "Expected '%s' Capsule", IMAGING_MAGIC);
8583
return NULL;
8684
}
8785

src/_imagingcms.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -541,9 +541,7 @@ cms_transform_apply(CmsTransformObject *self, PyObject *args) {
541541

542542
if (!PyCapsule_IsValid(i0, IMAGING_MAGIC) ||
543543
!PyCapsule_IsValid(i1, IMAGING_MAGIC)) {
544-
PyErr_Format(
545-
PyExc_TypeError, "Expected PyCapsule with '%s' name.", IMAGING_MAGIC
546-
);
544+
PyErr_Format(PyExc_TypeError, "Expected '%s' Capsule", IMAGING_MAGIC);
547545
return NULL;
548546
}
549547

src/_imagingmath.c

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -177,16 +177,12 @@ _unop(PyObject *self, PyObject *args) {
177177
}
178178

179179
if (!PyCapsule_IsValid(op, MATH_FUNC_UNOP_MAGIC)) {
180-
PyErr_Format(
181-
PyExc_TypeError, "Expected PyCapsule with '%s' name.", MATH_FUNC_UNOP_MAGIC
182-
);
180+
PyErr_Format(PyExc_TypeError, "Expected '%s' Capsule", MATH_FUNC_UNOP_MAGIC);
183181
return NULL;
184182
}
185183
if (!PyCapsule_IsValid(i0, IMAGING_MAGIC) ||
186184
!PyCapsule_IsValid(i1, IMAGING_MAGIC)) {
187-
PyErr_Format(
188-
PyExc_TypeError, "Expected PyCapsule with '%s' name.", IMAGING_MAGIC
189-
);
185+
PyErr_Format(PyExc_TypeError, "Expected '%s' Capsule", IMAGING_MAGIC);
190186
return NULL;
191187
}
192188

@@ -213,17 +209,13 @@ _binop(PyObject *self, PyObject *args) {
213209
}
214210

215211
if (!PyCapsule_IsValid(op, MATH_FUNC_BINOP_MAGIC)) {
216-
PyErr_Format(
217-
PyExc_TypeError, "Expected PyCapsule with '%s' name.", MATH_FUNC_BINOP_MAGIC
218-
);
212+
PyErr_Format(PyExc_TypeError, "Expected '%s' Capsule", MATH_FUNC_BINOP_MAGIC);
219213
return NULL;
220214
}
221215
if (!PyCapsule_IsValid(i0, IMAGING_MAGIC) ||
222216
!PyCapsule_IsValid(i1, IMAGING_MAGIC) ||
223217
!PyCapsule_IsValid(i2, IMAGING_MAGIC)) {
224-
PyErr_Format(
225-
PyExc_TypeError, "Expected PyCapsule with '%s' name.", IMAGING_MAGIC
226-
);
218+
PyErr_Format(PyExc_TypeError, "Expected '%s' Capsule", IMAGING_MAGIC);
227219
return NULL;
228220
}
229221

src/_imagingmorph.c

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,7 @@ apply(PyObject *self, PyObject *args) {
4848

4949
if (!PyCapsule_IsValid(i0, IMAGING_MAGIC) ||
5050
!PyCapsule_IsValid(i1, IMAGING_MAGIC)) {
51-
PyErr_Format(
52-
PyExc_TypeError, "Expected PyCapsule with '%s' name.", IMAGING_MAGIC
53-
);
51+
PyErr_Format(PyExc_TypeError, "Expected '%s' Capsule", IMAGING_MAGIC);
5452
return NULL;
5553
}
5654

@@ -143,9 +141,7 @@ match(PyObject *self, PyObject *args) {
143141
}
144142

145143
if (!PyCapsule_IsValid(i0, IMAGING_MAGIC)) {
146-
PyErr_Format(
147-
PyExc_TypeError, "Expected PyCapsule with '%s' name.", IMAGING_MAGIC
148-
);
144+
PyErr_Format(PyExc_TypeError, "Expected '%s' Capsule", IMAGING_MAGIC);
149145
return NULL;
150146
}
151147

@@ -218,9 +214,7 @@ get_on_pixels(PyObject *self, PyObject *args) {
218214
}
219215

220216
if (!PyCapsule_IsValid(i0, IMAGING_MAGIC)) {
221-
PyErr_Format(
222-
PyExc_TypeError, "Expected PyCapsule with '%s' name.", IMAGING_MAGIC
223-
);
217+
PyErr_Format(PyExc_TypeError, "Expected '%s' Capsule", IMAGING_MAGIC);
224218
return NULL;
225219
}
226220

0 commit comments

Comments
 (0)