From b083f13f87c9024e9f2433459f7a7475e5c6685a Mon Sep 17 00:00:00 2001 From: Hood Date: Mon, 15 Nov 2021 08:36:46 -0800 Subject: [PATCH] Revert "Don't cast getter function pointers" This reverts commit a2f65487ca3256754fefe800ae273eae3fbb027f. --- src/_imaging.c | 12 +++---- src/_imagingcms.c | 88 +++++++++++++++++++++++------------------------ src/_imagingft.c | 16 ++++----- src/decode.c | 2 +- src/display.c | 2 +- src/encode.c | 2 +- src/path.c | 2 +- 7 files changed, 62 insertions(+), 62 deletions(-) diff --git a/src/_imaging.c b/src/_imaging.c index 0957a71c8e2..e2193fec3c5 100644 --- a/src/_imaging.c +++ b/src/_imaging.c @@ -3568,12 +3568,12 @@ _getattr_unsafe_ptrs(ImagingObject *self, void *closure) { }; static struct PyGetSetDef getsetters[] = { - {"mode", _getattr_mode}, - {"size", _getattr_size}, - {"bands", _getattr_bands}, - {"id", _getattr_id}, - {"ptr", _getattr_ptr}, - {"unsafe_ptrs", _getattr_unsafe_ptrs}, + {"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}, {NULL}}; /* basic sequence semantics */ diff --git a/src/_imagingcms.c b/src/_imagingcms.c index 9e5e89e32eb..9b5a121d7d3 100644 --- a/src/_imagingcms.c +++ b/src/_imagingcms.c @@ -1370,52 +1370,52 @@ cms_profile_getattr_icc_viewing_condition(CmsProfileObject *self, void *closure) static struct PyGetSetDef cms_profile_getsetters[] = { /* New style interfaces. */ - {"rendering_intent", cms_profile_getattr_rendering_intent}, - {"creation_date", cms_profile_getattr_creation_date}, - {"copyright", cms_profile_getattr_copyright}, - {"target", cms_profile_getattr_target}, - {"manufacturer", cms_profile_getattr_manufacturer}, - {"model", cms_profile_getattr_model}, - {"profile_description", cms_profile_getattr_profile_description}, - {"screening_description", cms_profile_getattr_screening_description}, - {"viewing_condition", cms_profile_getattr_viewing_condition}, - {"version", cms_profile_getattr_version}, - {"icc_version", cms_profile_getattr_icc_version}, - {"attributes", cms_profile_getattr_attributes}, - {"header_flags", cms_profile_getattr_header_flags}, - {"header_manufacturer", cms_profile_getattr_header_manufacturer}, - {"header_model", cms_profile_getattr_header_model}, - {"device_class", cms_profile_getattr_device_class}, - {"connection_space", cms_profile_getattr_connection_space}, - {"xcolor_space", cms_profile_getattr_xcolor_space}, - {"profile_id", cms_profile_getattr_profile_id}, - {"is_matrix_shaper", cms_profile_getattr_is_matrix_shaper}, - {"technology", cms_profile_getattr_technology}, - {"colorimetric_intent", cms_profile_getattr_colorimetric_intent}, + {"rendering_intent", (getter)cms_profile_getattr_rendering_intent}, + {"creation_date", (getter)cms_profile_getattr_creation_date}, + {"copyright", (getter)cms_profile_getattr_copyright}, + {"target", (getter)cms_profile_getattr_target}, + {"manufacturer", (getter)cms_profile_getattr_manufacturer}, + {"model", (getter)cms_profile_getattr_model}, + {"profile_description", (getter)cms_profile_getattr_profile_description}, + {"screening_description", (getter)cms_profile_getattr_screening_description}, + {"viewing_condition", (getter)cms_profile_getattr_viewing_condition}, + {"version", (getter)cms_profile_getattr_version}, + {"icc_version", (getter)cms_profile_getattr_icc_version}, + {"attributes", (getter)cms_profile_getattr_attributes}, + {"header_flags", (getter)cms_profile_getattr_header_flags}, + {"header_manufacturer", (getter)cms_profile_getattr_header_manufacturer}, + {"header_model", (getter)cms_profile_getattr_header_model}, + {"device_class", (getter)cms_profile_getattr_device_class}, + {"connection_space", (getter)cms_profile_getattr_connection_space}, + {"xcolor_space", (getter)cms_profile_getattr_xcolor_space}, + {"profile_id", (getter)cms_profile_getattr_profile_id}, + {"is_matrix_shaper", (getter)cms_profile_getattr_is_matrix_shaper}, + {"technology", (getter)cms_profile_getattr_technology}, + {"colorimetric_intent", (getter)cms_profile_getattr_colorimetric_intent}, {"perceptual_rendering_intent_gamut", - cms_profile_getattr_perceptual_rendering_intent_gamut}, + (getter)cms_profile_getattr_perceptual_rendering_intent_gamut}, {"saturation_rendering_intent_gamut", - cms_profile_getattr_saturation_rendering_intent_gamut}, - {"red_colorant", cms_profile_getattr_red_colorant}, - {"green_colorant", cms_profile_getattr_green_colorant}, - {"blue_colorant", cms_profile_getattr_blue_colorant}, - {"red_primary", cms_profile_getattr_red_primary}, - {"green_primary", cms_profile_getattr_green_primary}, - {"blue_primary", cms_profile_getattr_blue_primary}, + (getter)cms_profile_getattr_saturation_rendering_intent_gamut}, + {"red_colorant", (getter)cms_profile_getattr_red_colorant}, + {"green_colorant", (getter)cms_profile_getattr_green_colorant}, + {"blue_colorant", (getter)cms_profile_getattr_blue_colorant}, + {"red_primary", (getter)cms_profile_getattr_red_primary}, + {"green_primary", (getter)cms_profile_getattr_green_primary}, + {"blue_primary", (getter)cms_profile_getattr_blue_primary}, {"media_white_point_temperature", - cms_profile_getattr_media_white_point_temperature}, - {"media_white_point", cms_profile_getattr_media_white_point}, - {"media_black_point", cms_profile_getattr_media_black_point}, - {"luminance", cms_profile_getattr_luminance}, - {"chromatic_adaptation", cms_profile_getattr_chromatic_adaptation}, - {"chromaticity", cms_profile_getattr_chromaticity}, - {"colorant_table", cms_profile_getattr_colorant_table}, - {"colorant_table_out", cms_profile_getattr_colorant_table_out}, - {"intent_supported", cms_profile_getattr_is_intent_supported}, - {"clut", cms_profile_getattr_is_clut}, + (getter)cms_profile_getattr_media_white_point_temperature}, + {"media_white_point", (getter)cms_profile_getattr_media_white_point}, + {"media_black_point", (getter)cms_profile_getattr_media_black_point}, + {"luminance", (getter)cms_profile_getattr_luminance}, + {"chromatic_adaptation", (getter)cms_profile_getattr_chromatic_adaptation}, + {"chromaticity", (getter)cms_profile_getattr_chromaticity}, + {"colorant_table", (getter)cms_profile_getattr_colorant_table}, + {"colorant_table_out", (getter)cms_profile_getattr_colorant_table_out}, + {"intent_supported", (getter)cms_profile_getattr_is_intent_supported}, + {"clut", (getter)cms_profile_getattr_is_clut}, {"icc_measurement_condition", - cms_profile_getattr_icc_measurement_condition}, - {"icc_viewing_condition", cms_profile_getattr_icc_viewing_condition}, + (getter)cms_profile_getattr_icc_measurement_condition}, + {"icc_viewing_condition", (getter)cms_profile_getattr_icc_viewing_condition}, {NULL}}; @@ -1467,8 +1467,8 @@ cms_transform_getattr_outputMode(CmsTransformObject *self, void *closure) { } static struct PyGetSetDef cms_transform_getsetters[] = { - {"inputMode", cms_transform_getattr_inputMode}, - {"outputMode", cms_transform_getattr_outputMode}, + {"inputMode", (getter)cms_transform_getattr_inputMode}, + {"outputMode", (getter)cms_transform_getattr_outputMode}, {NULL}}; static PyTypeObject CmsTransform_Type = { diff --git a/src/_imagingft.c b/src/_imagingft.c index 43faff2ed4b..8f19b763c5c 100644 --- a/src/_imagingft.c +++ b/src/_imagingft.c @@ -1281,14 +1281,14 @@ font_getattr_glyphs(FontObject *self, void *closure) { } static struct PyGetSetDef font_getsetters[] = { - {"family", font_getattr_family}, - {"style", font_getattr_style}, - {"ascent", font_getattr_ascent}, - {"descent", font_getattr_descent}, - {"height", font_getattr_height}, - {"x_ppem", font_getattr_x_ppem}, - {"y_ppem", font_getattr_y_ppem}, - {"glyphs", font_getattr_glyphs}, + {"family", (getter)font_getattr_family}, + {"style", (getter)font_getattr_style}, + {"ascent", (getter)font_getattr_ascent}, + {"descent", (getter)font_getattr_descent}, + {"height", (getter)font_getattr_height}, + {"x_ppem", (getter)font_getattr_x_ppem}, + {"y_ppem", (getter)font_getattr_y_ppem}, + {"glyphs", (getter)font_getattr_glyphs}, {NULL}}; static PyTypeObject Font_Type = { diff --git a/src/decode.c b/src/decode.c index b905dc3a9ea..cb018a4e706 100644 --- a/src/decode.c +++ b/src/decode.c @@ -249,7 +249,7 @@ static struct PyMethodDef methods[] = { static struct PyGetSetDef getseters[] = { {"pulls_fd", - _get_pulls_fd, + (getter)_get_pulls_fd, NULL, "True if this decoder expects to pull from self.fd itself.", NULL}, diff --git a/src/display.c b/src/display.c index 7843eddcef1..0ce10e2493c 100644 --- a/src/display.c +++ b/src/display.c @@ -246,7 +246,7 @@ _getattr_size(ImagingDisplayObject *self, void *closure) { } static struct PyGetSetDef getsetters[] = { - {"mode", _getattr_mode}, {"size", _getattr_size}, {NULL}}; + {"mode", (getter)_getattr_mode}, {"size", (getter)_getattr_size}, {NULL}}; static PyTypeObject ImagingDisplayType = { PyVarObject_HEAD_INIT(NULL, 0) "ImagingDisplay", /*tp_name*/ diff --git a/src/encode.c b/src/encode.c index 4ed3cb39cb6..2ecf9723bc6 100644 --- a/src/encode.c +++ b/src/encode.c @@ -315,7 +315,7 @@ static struct PyMethodDef methods[] = { static struct PyGetSetDef getseters[] = { {"pushes_fd", - _get_pushes_fd, + (getter)_get_pushes_fd, NULL, "True if this decoder expects to push directly to self.fd", NULL}, diff --git a/src/path.c b/src/path.c index a3836c1f27a..4764c58aa04 100644 --- a/src/path.c +++ b/src/path.c @@ -537,7 +537,7 @@ path_getattr_id(PyPathObject *self, void *closure) { return Py_BuildValue("n", (Py_ssize_t)self->xy); } -static struct PyGetSetDef getsetters[] = {{"id", path_getattr_id}, {NULL}}; +static struct PyGetSetDef getsetters[] = {{"id", (getter)path_getattr_id}, {NULL}}; static PyObject * path_subscript(PyPathObject *self, PyObject *item) {