rename PyCapsule -> Capsule

This commit is contained in:
Aleksandr Karpinskii 2024-09-03 11:54:24 +04:00
parent 147f75ee93
commit bf11639626
5 changed files with 10 additions and 28 deletions

View File

@ -144,7 +144,7 @@ Get Internal Pointers to Objects
``Image.core.ImageCore.id`` and ``Image.core.ImageCore.unsafe_ptrs`` ``Image.core.ImageCore.id`` and ``Image.core.ImageCore.unsafe_ptrs``
have been deprecated and will be removed in Pillow 12 (2025-10-15). 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 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 Removed features
---------------- ----------------

View File

@ -79,9 +79,7 @@ ImagingFind(const char *name) {
} }
if (!PyCapsule_IsValid(capsule, IMAGING_MAGIC)) { if (!PyCapsule_IsValid(capsule, IMAGING_MAGIC)) {
PyErr_Format( PyErr_Format(PyExc_TypeError, "Expected '%s' Capsule", IMAGING_MAGIC);
PyExc_TypeError, "Expected PyCapsule with '%s' name.", IMAGING_MAGIC
);
return NULL; return NULL;
} }

View File

@ -541,9 +541,7 @@ cms_transform_apply(CmsTransformObject *self, PyObject *args) {
if (!PyCapsule_IsValid(i0, IMAGING_MAGIC) || if (!PyCapsule_IsValid(i0, IMAGING_MAGIC) ||
!PyCapsule_IsValid(i1, IMAGING_MAGIC)) { !PyCapsule_IsValid(i1, IMAGING_MAGIC)) {
PyErr_Format( PyErr_Format(PyExc_TypeError, "Expected '%s' Capsule", IMAGING_MAGIC);
PyExc_TypeError, "Expected PyCapsule with '%s' name.", IMAGING_MAGIC
);
return NULL; return NULL;
} }

View File

@ -177,16 +177,12 @@ _unop(PyObject *self, PyObject *args) {
} }
if (!PyCapsule_IsValid(op, MATH_FUNC_UNOP_MAGIC)) { if (!PyCapsule_IsValid(op, MATH_FUNC_UNOP_MAGIC)) {
PyErr_Format( PyErr_Format(PyExc_TypeError, "Expected '%s' Capsule", MATH_FUNC_UNOP_MAGIC);
PyExc_TypeError, "Expected PyCapsule with '%s' name.", MATH_FUNC_UNOP_MAGIC
);
return NULL; return NULL;
} }
if (!PyCapsule_IsValid(i0, IMAGING_MAGIC) || if (!PyCapsule_IsValid(i0, IMAGING_MAGIC) ||
!PyCapsule_IsValid(i1, IMAGING_MAGIC)) { !PyCapsule_IsValid(i1, IMAGING_MAGIC)) {
PyErr_Format( PyErr_Format(PyExc_TypeError, "Expected '%s' Capsule", IMAGING_MAGIC);
PyExc_TypeError, "Expected PyCapsule with '%s' name.", IMAGING_MAGIC
);
return NULL; return NULL;
} }
@ -213,17 +209,13 @@ _binop(PyObject *self, PyObject *args) {
} }
if (!PyCapsule_IsValid(op, MATH_FUNC_BINOP_MAGIC)) { if (!PyCapsule_IsValid(op, MATH_FUNC_BINOP_MAGIC)) {
PyErr_Format( PyErr_Format(PyExc_TypeError, "Expected '%s' Capsule", MATH_FUNC_BINOP_MAGIC);
PyExc_TypeError, "Expected PyCapsule with '%s' name.", MATH_FUNC_BINOP_MAGIC
);
return NULL; return NULL;
} }
if (!PyCapsule_IsValid(i0, IMAGING_MAGIC) || if (!PyCapsule_IsValid(i0, IMAGING_MAGIC) ||
!PyCapsule_IsValid(i1, IMAGING_MAGIC) || !PyCapsule_IsValid(i1, IMAGING_MAGIC) ||
!PyCapsule_IsValid(i2, IMAGING_MAGIC)) { !PyCapsule_IsValid(i2, IMAGING_MAGIC)) {
PyErr_Format( PyErr_Format(PyExc_TypeError, "Expected '%s' Capsule", IMAGING_MAGIC);
PyExc_TypeError, "Expected PyCapsule with '%s' name.", IMAGING_MAGIC
);
return NULL; return NULL;
} }

View File

@ -48,9 +48,7 @@ apply(PyObject *self, PyObject *args) {
if (!PyCapsule_IsValid(i0, IMAGING_MAGIC) || if (!PyCapsule_IsValid(i0, IMAGING_MAGIC) ||
!PyCapsule_IsValid(i1, IMAGING_MAGIC)) { !PyCapsule_IsValid(i1, IMAGING_MAGIC)) {
PyErr_Format( PyErr_Format(PyExc_TypeError, "Expected '%s' Capsule", IMAGING_MAGIC);
PyExc_TypeError, "Expected PyCapsule with '%s' name.", IMAGING_MAGIC
);
return NULL; return NULL;
} }
@ -143,9 +141,7 @@ match(PyObject *self, PyObject *args) {
} }
if (!PyCapsule_IsValid(i0, IMAGING_MAGIC)) { if (!PyCapsule_IsValid(i0, IMAGING_MAGIC)) {
PyErr_Format( PyErr_Format(PyExc_TypeError, "Expected '%s' Capsule", IMAGING_MAGIC);
PyExc_TypeError, "Expected PyCapsule with '%s' name.", IMAGING_MAGIC
);
return NULL; return NULL;
} }
@ -218,9 +214,7 @@ get_on_pixels(PyObject *self, PyObject *args) {
} }
if (!PyCapsule_IsValid(i0, IMAGING_MAGIC)) { if (!PyCapsule_IsValid(i0, IMAGING_MAGIC)) {
PyErr_Format( PyErr_Format(PyExc_TypeError, "Expected '%s' Capsule", IMAGING_MAGIC);
PyExc_TypeError, "Expected PyCapsule with '%s' name.", IMAGING_MAGIC
);
return NULL; return NULL;
} }