Merge pull request #8741 from radarhere/type

This commit is contained in:
Hugo van Kemenade 2025-02-17 13:29:44 +02:00 committed by GitHub
commit a254b8cfeb
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
9 changed files with 66 additions and 404 deletions

View File

@ -3769,102 +3769,26 @@ static PySequenceMethods image_as_sequence = {
/* type description */ /* type description */
static PyTypeObject Imaging_Type = { static PyTypeObject Imaging_Type = {
PyVarObject_HEAD_INIT(NULL, 0) "ImagingCore", /*tp_name*/ PyVarObject_HEAD_INIT(NULL, 0).tp_name = "ImagingCore",
sizeof(ImagingObject), /*tp_basicsize*/ .tp_basicsize = sizeof(ImagingObject),
0, /*tp_itemsize*/ .tp_dealloc = (destructor)_dealloc,
/* methods */ .tp_as_sequence = &image_as_sequence,
(destructor)_dealloc, /*tp_dealloc*/ .tp_methods = methods,
0, /*tp_vectorcall_offset*/ .tp_getset = getsetters,
0, /*tp_getattr*/
0, /*tp_setattr*/
0, /*tp_as_async*/
0, /*tp_repr*/
0, /*tp_as_number*/
&image_as_sequence, /*tp_as_sequence*/
0, /*tp_as_mapping*/
0, /*tp_hash*/
0, /*tp_call*/
0, /*tp_str*/
0, /*tp_getattro*/
0, /*tp_setattro*/
0, /*tp_as_buffer*/
Py_TPFLAGS_DEFAULT, /*tp_flags*/
0, /*tp_doc*/
0, /*tp_traverse*/
0, /*tp_clear*/
0, /*tp_richcompare*/
0, /*tp_weaklistoffset*/
0, /*tp_iter*/
0, /*tp_iternext*/
methods, /*tp_methods*/
0, /*tp_members*/
getsetters, /*tp_getset*/
}; };
static PyTypeObject ImagingFont_Type = { static PyTypeObject ImagingFont_Type = {
PyVarObject_HEAD_INIT(NULL, 0) "ImagingFont", /*tp_name*/ PyVarObject_HEAD_INIT(NULL, 0).tp_name = "ImagingFont",
sizeof(ImagingFontObject), /*tp_basicsize*/ .tp_basicsize = sizeof(ImagingFontObject),
0, /*tp_itemsize*/ .tp_dealloc = (destructor)_font_dealloc,
/* methods */ .tp_methods = _font_methods,
(destructor)_font_dealloc, /*tp_dealloc*/
0, /*tp_vectorcall_offset*/
0, /*tp_getattr*/
0, /*tp_setattr*/
0, /*tp_as_async*/
0, /*tp_repr*/
0, /*tp_as_number*/
0, /*tp_as_sequence*/
0, /*tp_as_mapping*/
0, /*tp_hash*/
0, /*tp_call*/
0, /*tp_str*/
0, /*tp_getattro*/
0, /*tp_setattro*/
0, /*tp_as_buffer*/
Py_TPFLAGS_DEFAULT, /*tp_flags*/
0, /*tp_doc*/
0, /*tp_traverse*/
0, /*tp_clear*/
0, /*tp_richcompare*/
0, /*tp_weaklistoffset*/
0, /*tp_iter*/
0, /*tp_iternext*/
_font_methods, /*tp_methods*/
0, /*tp_members*/
0, /*tp_getset*/
}; };
static PyTypeObject ImagingDraw_Type = { static PyTypeObject ImagingDraw_Type = {
PyVarObject_HEAD_INIT(NULL, 0) "ImagingDraw", /*tp_name*/ PyVarObject_HEAD_INIT(NULL, 0).tp_name = "ImagingDraw",
sizeof(ImagingDrawObject), /*tp_basicsize*/ .tp_basicsize = sizeof(ImagingDrawObject),
0, /*tp_itemsize*/ .tp_dealloc = (destructor)_draw_dealloc,
/* methods */ .tp_methods = _draw_methods,
(destructor)_draw_dealloc, /*tp_dealloc*/
0, /*tp_vectorcall_offset*/
0, /*tp_getattr*/
0, /*tp_setattr*/
0, /*tp_as_async*/
0, /*tp_repr*/
0, /*tp_as_number*/
0, /*tp_as_sequence*/
0, /*tp_as_mapping*/
0, /*tp_hash*/
0, /*tp_call*/
0, /*tp_str*/
0, /*tp_getattro*/
0, /*tp_setattro*/
0, /*tp_as_buffer*/
Py_TPFLAGS_DEFAULT, /*tp_flags*/
0, /*tp_doc*/
0, /*tp_traverse*/
0, /*tp_clear*/
0, /*tp_richcompare*/
0, /*tp_weaklistoffset*/
0, /*tp_iter*/
0, /*tp_iternext*/
_draw_methods, /*tp_methods*/
0, /*tp_members*/
0, /*tp_getset*/
}; };
static PyMappingMethods pixel_access_as_mapping = { static PyMappingMethods pixel_access_as_mapping = {
@ -3876,20 +3800,10 @@ static PyMappingMethods pixel_access_as_mapping = {
/* type description */ /* type description */
static PyTypeObject PixelAccess_Type = { static PyTypeObject PixelAccess_Type = {
PyVarObject_HEAD_INIT(NULL, 0) "PixelAccess", /*tp_name*/ PyVarObject_HEAD_INIT(NULL, 0).tp_name = "PixelAccess",
sizeof(PixelAccessObject), /*tp_basicsize*/ .tp_basicsize = sizeof(PixelAccessObject),
0, /*tp_itemsize*/ .tp_dealloc = (destructor)pixel_access_dealloc,
/* methods */ .tp_as_mapping = &pixel_access_as_mapping,
(destructor)pixel_access_dealloc, /*tp_dealloc*/
0, /*tp_vectorcall_offset*/
0, /*tp_getattr*/
0, /*tp_setattr*/
0, /*tp_as_async*/
0, /*tp_repr*/
0, /*tp_as_number*/
0, /*tp_as_sequence*/
&pixel_access_as_mapping, /*tp_as_mapping*/
0 /*tp_hash*/
}; };
/* -------------------------------------------------------------------- */ /* -------------------------------------------------------------------- */

View File

@ -1410,36 +1410,11 @@ static struct PyGetSetDef cms_profile_getsetters[] = {
}; };
static PyTypeObject CmsProfile_Type = { static PyTypeObject CmsProfile_Type = {
PyVarObject_HEAD_INIT(NULL, 0) "PIL.ImageCms.core.CmsProfile", /*tp_name*/ PyVarObject_HEAD_INIT(NULL, 0).tp_name = "PIL.ImageCms.core.CmsProfile",
sizeof(CmsProfileObject), /*tp_basicsize*/ .tp_basicsize = sizeof(CmsProfileObject),
0, /*tp_itemsize*/ .tp_dealloc = (destructor)cms_profile_dealloc,
/* methods */ .tp_methods = cms_profile_methods,
(destructor)cms_profile_dealloc, /*tp_dealloc*/ .tp_getset = cms_profile_getsetters,
0, /*tp_vectorcall_offset*/
0, /*tp_getattr*/
0, /*tp_setattr*/
0, /*tp_as_async*/
0, /*tp_repr*/
0, /*tp_as_number*/
0, /*tp_as_sequence*/
0, /*tp_as_mapping*/
0, /*tp_hash*/
0, /*tp_call*/
0, /*tp_str*/
0, /*tp_getattro*/
0, /*tp_setattro*/
0, /*tp_as_buffer*/
Py_TPFLAGS_DEFAULT, /*tp_flags*/
0, /*tp_doc*/
0, /*tp_traverse*/
0, /*tp_clear*/
0, /*tp_richcompare*/
0, /*tp_weaklistoffset*/
0, /*tp_iter*/
0, /*tp_iternext*/
cms_profile_methods, /*tp_methods*/
0, /*tp_members*/
cms_profile_getsetters, /*tp_getset*/
}; };
static struct PyMethodDef cms_transform_methods[] = { static struct PyMethodDef cms_transform_methods[] = {
@ -1447,36 +1422,10 @@ static struct PyMethodDef cms_transform_methods[] = {
}; };
static PyTypeObject CmsTransform_Type = { static PyTypeObject CmsTransform_Type = {
PyVarObject_HEAD_INIT(NULL, 0) "PIL.ImageCms.core.CmsTransform", /*tp_name*/ PyVarObject_HEAD_INIT(NULL, 0).tp_name = "PIL.ImageCms.core.CmsTransform",
sizeof(CmsTransformObject), /*tp_basicsize*/ .tp_basicsize = sizeof(CmsTransformObject),
0, /*tp_itemsize*/ .tp_dealloc = (destructor)cms_transform_dealloc,
/* methods */ .tp_methods = cms_transform_methods,
(destructor)cms_transform_dealloc, /*tp_dealloc*/
0, /*tp_vectorcall_offset*/
0, /*tp_getattr*/
0, /*tp_setattr*/
0, /*tp_as_async*/
0, /*tp_repr*/
0, /*tp_as_number*/
0, /*tp_as_sequence*/
0, /*tp_as_mapping*/
0, /*tp_hash*/
0, /*tp_call*/
0, /*tp_str*/
0, /*tp_getattro*/
0, /*tp_setattro*/
0, /*tp_as_buffer*/
Py_TPFLAGS_DEFAULT, /*tp_flags*/
0, /*tp_doc*/
0, /*tp_traverse*/
0, /*tp_clear*/
0, /*tp_richcompare*/
0, /*tp_weaklistoffset*/
0, /*tp_iter*/
0, /*tp_iternext*/
cms_transform_methods, /*tp_methods*/
0, /*tp_members*/
0, /*tp_getset*/
}; };
static int static int

View File

@ -1518,36 +1518,11 @@ static struct PyGetSetDef font_getsetters[] = {
}; };
static PyTypeObject Font_Type = { static PyTypeObject Font_Type = {
PyVarObject_HEAD_INIT(NULL, 0) "Font", /*tp_name*/ PyVarObject_HEAD_INIT(NULL, 0).tp_name = "Font",
sizeof(FontObject), /*tp_basicsize*/ .tp_basicsize = sizeof(FontObject),
0, /*tp_itemsize*/ .tp_dealloc = (destructor)font_dealloc,
/* methods */ .tp_methods = font_methods,
(destructor)font_dealloc, /*tp_dealloc*/ .tp_getset = font_getsetters,
0, /*tp_vectorcall_offset*/
0, /*tp_getattr*/
0, /*tp_setattr*/
0, /*tp_as_async*/
0, /*tp_repr*/
0, /*tp_as_number*/
0, /*tp_as_sequence*/
0, /*tp_as_mapping*/
0, /*tp_hash*/
0, /*tp_call*/
0, /*tp_str*/
0, /*tp_getattro*/
0, /*tp_setattro*/
0, /*tp_as_buffer*/
Py_TPFLAGS_DEFAULT, /*tp_flags*/
0, /*tp_doc*/
0, /*tp_traverse*/
0, /*tp_clear*/
0, /*tp_richcompare*/
0, /*tp_weaklistoffset*/
0, /*tp_iter*/
0, /*tp_iternext*/
font_methods, /*tp_methods*/
0, /*tp_members*/
font_getsetters, /*tp_getset*/
}; };
static PyMethodDef _functions[] = { static PyMethodDef _functions[] = {

View File

@ -530,36 +530,10 @@ static struct PyMethodDef _anim_encoder_methods[] = {
// WebPAnimEncoder type definition // WebPAnimEncoder type definition
static PyTypeObject WebPAnimEncoder_Type = { static PyTypeObject WebPAnimEncoder_Type = {
PyVarObject_HEAD_INIT(NULL, 0) "WebPAnimEncoder", /*tp_name */ PyVarObject_HEAD_INIT(NULL, 0).tp_name = "WebPAnimEncoder",
sizeof(WebPAnimEncoderObject), /*tp_basicsize */ .tp_basicsize = sizeof(WebPAnimEncoderObject),
0, /*tp_itemsize */ .tp_dealloc = (destructor)_anim_encoder_dealloc,
/* methods */ .tp_methods = _anim_encoder_methods,
(destructor)_anim_encoder_dealloc, /*tp_dealloc*/
0, /*tp_vectorcall_offset*/
0, /*tp_getattr*/
0, /*tp_setattr*/
0, /*tp_as_async*/
0, /*tp_repr*/
0, /*tp_as_number*/
0, /*tp_as_sequence*/
0, /*tp_as_mapping*/
0, /*tp_hash*/
0, /*tp_call*/
0, /*tp_str*/
0, /*tp_getattro*/
0, /*tp_setattro*/
0, /*tp_as_buffer*/
Py_TPFLAGS_DEFAULT, /*tp_flags*/
0, /*tp_doc*/
0, /*tp_traverse*/
0, /*tp_clear*/
0, /*tp_richcompare*/
0, /*tp_weaklistoffset*/
0, /*tp_iter*/
0, /*tp_iternext*/
_anim_encoder_methods, /*tp_methods*/
0, /*tp_members*/
0, /*tp_getset*/
}; };
// WebPAnimDecoder methods // WebPAnimDecoder methods
@ -573,36 +547,10 @@ static struct PyMethodDef _anim_decoder_methods[] = {
// WebPAnimDecoder type definition // WebPAnimDecoder type definition
static PyTypeObject WebPAnimDecoder_Type = { static PyTypeObject WebPAnimDecoder_Type = {
PyVarObject_HEAD_INIT(NULL, 0) "WebPAnimDecoder", /*tp_name */ PyVarObject_HEAD_INIT(NULL, 0).tp_name = "WebPAnimDecoder",
sizeof(WebPAnimDecoderObject), /*tp_basicsize */ .tp_basicsize = sizeof(WebPAnimDecoderObject),
0, /*tp_itemsize */ .tp_dealloc = (destructor)_anim_decoder_dealloc,
/* methods */ .tp_methods = _anim_decoder_methods,
(destructor)_anim_decoder_dealloc, /*tp_dealloc*/
0, /*tp_vectorcall_offset*/
0, /*tp_getattr*/
0, /*tp_setattr*/
0, /*tp_as_async*/
0, /*tp_repr*/
0, /*tp_as_number*/
0, /*tp_as_sequence*/
0, /*tp_as_mapping*/
0, /*tp_hash*/
0, /*tp_call*/
0, /*tp_str*/
0, /*tp_getattro*/
0, /*tp_setattro*/
0, /*tp_as_buffer*/
Py_TPFLAGS_DEFAULT, /*tp_flags*/
0, /*tp_doc*/
0, /*tp_traverse*/
0, /*tp_clear*/
0, /*tp_richcompare*/
0, /*tp_weaklistoffset*/
0, /*tp_iter*/
0, /*tp_iternext*/
_anim_decoder_methods, /*tp_methods*/
0, /*tp_members*/
0, /*tp_getset*/
}; };
/* -------------------------------------------------------------------- */ /* -------------------------------------------------------------------- */

View File

@ -256,36 +256,11 @@ static struct PyGetSetDef getseters[] = {
}; };
static PyTypeObject ImagingDecoderType = { static PyTypeObject ImagingDecoderType = {
PyVarObject_HEAD_INIT(NULL, 0) "ImagingDecoder", /*tp_name*/ PyVarObject_HEAD_INIT(NULL, 0).tp_name = "ImagingDecoder",
sizeof(ImagingDecoderObject), /*tp_basicsize*/ .tp_basicsize = sizeof(ImagingDecoderObject),
0, /*tp_itemsize*/ .tp_dealloc = (destructor)_dealloc,
/* methods */ .tp_methods = methods,
(destructor)_dealloc, /*tp_dealloc*/ .tp_getset = getseters,
0, /*tp_vectorcall_offset*/
0, /*tp_getattr*/
0, /*tp_setattr*/
0, /*tp_as_async*/
0, /*tp_repr*/
0, /*tp_as_number*/
0, /*tp_as_sequence*/
0, /*tp_as_mapping*/
0, /*tp_hash*/
0, /*tp_call*/
0, /*tp_str*/
0, /*tp_getattro*/
0, /*tp_setattro*/
0, /*tp_as_buffer*/
Py_TPFLAGS_DEFAULT, /*tp_flags*/
0, /*tp_doc*/
0, /*tp_traverse*/
0, /*tp_clear*/
0, /*tp_richcompare*/
0, /*tp_weaklistoffset*/
0, /*tp_iter*/
0, /*tp_iternext*/
methods, /*tp_methods*/
0, /*tp_members*/
getseters, /*tp_getset*/
}; };
/* -------------------------------------------------------------------- */ /* -------------------------------------------------------------------- */

View File

@ -248,36 +248,11 @@ static struct PyGetSetDef getsetters[] = {
}; };
static PyTypeObject ImagingDisplayType = { static PyTypeObject ImagingDisplayType = {
PyVarObject_HEAD_INIT(NULL, 0) "ImagingDisplay", /*tp_name*/ PyVarObject_HEAD_INIT(NULL, 0).tp_name = "ImagingDisplay",
sizeof(ImagingDisplayObject), /*tp_basicsize*/ .tp_basicsize = sizeof(ImagingDisplayObject),
0, /*tp_itemsize*/ .tp_dealloc = (destructor)_delete,
/* methods */ .tp_methods = methods,
(destructor)_delete, /*tp_dealloc*/ .tp_getset = getsetters,
0, /*tp_vectorcall_offset*/
0, /*tp_getattr*/
0, /*tp_setattr*/
0, /*tp_as_async*/
0, /*tp_repr*/
0, /*tp_as_number*/
0, /*tp_as_sequence*/
0, /*tp_as_mapping*/
0, /*tp_hash*/
0, /*tp_call*/
0, /*tp_str*/
0, /*tp_getattro*/
0, /*tp_setattro*/
0, /*tp_as_buffer*/
Py_TPFLAGS_DEFAULT, /*tp_flags*/
0, /*tp_doc*/
0, /*tp_traverse*/
0, /*tp_clear*/
0, /*tp_richcompare*/
0, /*tp_weaklistoffset*/
0, /*tp_iter*/
0, /*tp_iternext*/
methods, /*tp_methods*/
0, /*tp_members*/
getsetters, /*tp_getset*/
}; };
PyObject * PyObject *

View File

@ -323,36 +323,11 @@ static struct PyGetSetDef getseters[] = {
}; };
static PyTypeObject ImagingEncoderType = { static PyTypeObject ImagingEncoderType = {
PyVarObject_HEAD_INIT(NULL, 0) "ImagingEncoder", /*tp_name*/ PyVarObject_HEAD_INIT(NULL, 0).tp_name = "ImagingEncoder",
sizeof(ImagingEncoderObject), /*tp_basicsize*/ .tp_basicsize = sizeof(ImagingEncoderObject),
0, /*tp_itemsize*/ .tp_dealloc = (destructor)_dealloc,
/* methods */ .tp_methods = methods,
(destructor)_dealloc, /*tp_dealloc*/ .tp_getset = getseters,
0, /*tp_vectorcall_offset*/
0, /*tp_getattr*/
0, /*tp_setattr*/
0, /*tp_as_async*/
0, /*tp_repr*/
0, /*tp_as_number*/
0, /*tp_as_sequence*/
0, /*tp_as_mapping*/
0, /*tp_hash*/
0, /*tp_call*/
0, /*tp_str*/
0, /*tp_getattro*/
0, /*tp_setattro*/
0, /*tp_as_buffer*/
Py_TPFLAGS_DEFAULT, /*tp_flags*/
0, /*tp_doc*/
0, /*tp_traverse*/
0, /*tp_clear*/
0, /*tp_richcompare*/
0, /*tp_weaklistoffset*/
0, /*tp_iter*/
0, /*tp_iternext*/
methods, /*tp_methods*/
0, /*tp_members*/
getseters, /*tp_getset*/
}; };
/* -------------------------------------------------------------------- */ /* -------------------------------------------------------------------- */

View File

@ -149,34 +149,8 @@ static struct PyMethodDef _outline_methods[] = {
}; };
static PyTypeObject OutlineType = { static PyTypeObject OutlineType = {
PyVarObject_HEAD_INIT(NULL, 0) "Outline", /*tp_name*/ PyVarObject_HEAD_INIT(NULL, 0).tp_name = "Outline",
sizeof(OutlineObject), /*tp_basicsize*/ .tp_basicsize = sizeof(OutlineObject),
0, /*tp_itemsize*/ .tp_dealloc = (destructor)_outline_dealloc,
/* methods */ .tp_methods = _outline_methods,
(destructor)_outline_dealloc, /*tp_dealloc*/
0, /*tp_vectorcall_offset*/
0, /*tp_getattr*/
0, /*tp_setattr*/
0, /*tp_as_async*/
0, /*tp_repr*/
0, /*tp_as_number*/
0, /*tp_as_sequence*/
0, /*tp_as_mapping*/
0, /*tp_hash*/
0, /*tp_call*/
0, /*tp_str*/
0, /*tp_getattro*/
0, /*tp_setattro*/
0, /*tp_as_buffer*/
Py_TPFLAGS_DEFAULT, /*tp_flags*/
0, /*tp_doc*/
0, /*tp_traverse*/
0, /*tp_clear*/
0, /*tp_richcompare*/
0, /*tp_weaklistoffset*/
0, /*tp_iter*/
0, /*tp_iternext*/
_outline_methods, /*tp_methods*/
0, /*tp_members*/
0, /*tp_getset*/
}; };

View File

@ -598,34 +598,11 @@ static PyMappingMethods path_as_mapping = {
}; };
static PyTypeObject PyPathType = { static PyTypeObject PyPathType = {
PyVarObject_HEAD_INIT(NULL, 0) "Path", /*tp_name*/ PyVarObject_HEAD_INIT(NULL, 0).tp_name = "Path",
sizeof(PyPathObject), /*tp_basicsize*/ .tp_basicsize = sizeof(PyPathObject),
0, /*tp_itemsize*/ .tp_dealloc = (destructor)path_dealloc,
/* methods */ .tp_as_sequence = &path_as_sequence,
(destructor)path_dealloc, /*tp_dealloc*/ .tp_as_mapping = &path_as_mapping,
0, /*tp_vectorcall_offset*/ .tp_methods = methods,
0, /*tp_getattr*/ .tp_getset = getsetters,
0, /*tp_setattr*/
0, /*tp_as_async*/
0, /*tp_repr*/
0, /*tp_as_number*/
&path_as_sequence, /*tp_as_sequence*/
&path_as_mapping, /*tp_as_mapping*/
0, /*tp_hash*/
0, /*tp_call*/
0, /*tp_str*/
0, /*tp_getattro*/
0, /*tp_setattro*/
0, /*tp_as_buffer*/
Py_TPFLAGS_DEFAULT, /*tp_flags*/
0, /*tp_doc*/
0, /*tp_traverse*/
0, /*tp_clear*/
0, /*tp_richcompare*/
0, /*tp_weaklistoffset*/
0, /*tp_iter*/
0, /*tp_iternext*/
methods, /*tp_methods*/
0, /*tp_members*/
getsetters, /*tp_getset*/
}; };