Skip to content

Commit

Permalink
rename PyCapsule -> Capsule
Browse files Browse the repository at this point in the history
  • Loading branch information
homm committed Sep 3, 2024
1 parent 147f75e commit bf11639
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 28 deletions.
2 changes: 1 addition & 1 deletion docs/deprecations.rst
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ Get Internal Pointers to Objects
``Image.core.ImageCore.id`` and ``Image.core.ImageCore.unsafe_ptrs``
have been deprecated and will be removed in Pillow 12 (2025-10-15).
They were used for obtaining raw pointers to ``ImageCore`` internals. To interact with
C code, you can use ``Image.core.ImageCore.ptr``, which returns a ``PyCapsule`` object.
C code, you can use ``Image.core.ImageCore.ptr``, which returns a ``Capsule`` object.

Removed features
----------------
Expand Down
4 changes: 1 addition & 3 deletions src/Tk/tkImaging.c
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,7 @@ ImagingFind(const char *name) {
}

if (!PyCapsule_IsValid(capsule, IMAGING_MAGIC)) {
PyErr_Format(
PyExc_TypeError, "Expected PyCapsule with '%s' name.", IMAGING_MAGIC
);
PyErr_Format(PyExc_TypeError, "Expected '%s' Capsule", IMAGING_MAGIC);
return NULL;
}

Expand Down
4 changes: 1 addition & 3 deletions src/_imagingcms.c
Original file line number Diff line number Diff line change
Expand Up @@ -541,9 +541,7 @@ cms_transform_apply(CmsTransformObject *self, PyObject *args) {

if (!PyCapsule_IsValid(i0, IMAGING_MAGIC) ||
!PyCapsule_IsValid(i1, IMAGING_MAGIC)) {
PyErr_Format(
PyExc_TypeError, "Expected PyCapsule with '%s' name.", IMAGING_MAGIC
);
PyErr_Format(PyExc_TypeError, "Expected '%s' Capsule", IMAGING_MAGIC);
return NULL;
}

Expand Down
16 changes: 4 additions & 12 deletions src/_imagingmath.c
Original file line number Diff line number Diff line change
Expand Up @@ -177,16 +177,12 @@ _unop(PyObject *self, PyObject *args) {
}

if (!PyCapsule_IsValid(op, MATH_FUNC_UNOP_MAGIC)) {
PyErr_Format(
PyExc_TypeError, "Expected PyCapsule with '%s' name.", MATH_FUNC_UNOP_MAGIC
);
PyErr_Format(PyExc_TypeError, "Expected '%s' Capsule", MATH_FUNC_UNOP_MAGIC);
return NULL;
}
if (!PyCapsule_IsValid(i0, IMAGING_MAGIC) ||
!PyCapsule_IsValid(i1, IMAGING_MAGIC)) {
PyErr_Format(
PyExc_TypeError, "Expected PyCapsule with '%s' name.", IMAGING_MAGIC
);
PyErr_Format(PyExc_TypeError, "Expected '%s' Capsule", IMAGING_MAGIC);
return NULL;
}

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

if (!PyCapsule_IsValid(op, MATH_FUNC_BINOP_MAGIC)) {
PyErr_Format(
PyExc_TypeError, "Expected PyCapsule with '%s' name.", MATH_FUNC_BINOP_MAGIC
);
PyErr_Format(PyExc_TypeError, "Expected '%s' Capsule", MATH_FUNC_BINOP_MAGIC);
return NULL;
}
if (!PyCapsule_IsValid(i0, IMAGING_MAGIC) ||
!PyCapsule_IsValid(i1, IMAGING_MAGIC) ||
!PyCapsule_IsValid(i2, IMAGING_MAGIC)) {
PyErr_Format(
PyExc_TypeError, "Expected PyCapsule with '%s' name.", IMAGING_MAGIC
);
PyErr_Format(PyExc_TypeError, "Expected '%s' Capsule", IMAGING_MAGIC);
return NULL;
}

Expand Down
12 changes: 3 additions & 9 deletions src/_imagingmorph.c
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,7 @@ apply(PyObject *self, PyObject *args) {

if (!PyCapsule_IsValid(i0, IMAGING_MAGIC) ||
!PyCapsule_IsValid(i1, IMAGING_MAGIC)) {
PyErr_Format(
PyExc_TypeError, "Expected PyCapsule with '%s' name.", IMAGING_MAGIC
);
PyErr_Format(PyExc_TypeError, "Expected '%s' Capsule", IMAGING_MAGIC);
return NULL;
}

Expand Down Expand Up @@ -143,9 +141,7 @@ match(PyObject *self, PyObject *args) {
}

if (!PyCapsule_IsValid(i0, IMAGING_MAGIC)) {
PyErr_Format(
PyExc_TypeError, "Expected PyCapsule with '%s' name.", IMAGING_MAGIC
);
PyErr_Format(PyExc_TypeError, "Expected '%s' Capsule", IMAGING_MAGIC);
return NULL;
}

Expand Down Expand Up @@ -218,9 +214,7 @@ get_on_pixels(PyObject *self, PyObject *args) {
}

if (!PyCapsule_IsValid(i0, IMAGING_MAGIC)) {
PyErr_Format(
PyExc_TypeError, "Expected PyCapsule with '%s' name.", IMAGING_MAGIC
);
PyErr_Format(PyExc_TypeError, "Expected '%s' Capsule", IMAGING_MAGIC);
return NULL;
}

Expand Down

0 comments on commit bf11639

Please sign in to comment.