Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix METH_VARARGS method signatures #21628

Merged
merged 6 commits into from
Nov 15, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
32 changes: 16 additions & 16 deletions src/_backend_agg_wrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,15 @@ static void PyBufferRegion_dealloc(PyBufferRegion *self)
Py_TYPE(self)->tp_free((PyObject *)self);
}

static PyObject *PyBufferRegion_to_string(PyBufferRegion *self, PyObject *args, PyObject *kwds)
static PyObject *PyBufferRegion_to_string(PyBufferRegion *self, PyObject *args)
{
return PyBytes_FromStringAndSize((const char *)self->x->get_data(),
self->x->get_height() * self->x->get_stride());
}

/* TODO: This doesn't seem to be used internally. Remove? */

static PyObject *PyBufferRegion_set_x(PyBufferRegion *self, PyObject *args, PyObject *kwds)
static PyObject *PyBufferRegion_set_x(PyBufferRegion *self, PyObject *args)
{
int x;
if (!PyArg_ParseTuple(args, "i:set_x", &x)) {
Expand All @@ -59,7 +59,7 @@ static PyObject *PyBufferRegion_set_x(PyBufferRegion *self, PyObject *args, PyOb
Py_RETURN_NONE;
}

static PyObject *PyBufferRegion_set_y(PyBufferRegion *self, PyObject *args, PyObject *kwds)
static PyObject *PyBufferRegion_set_y(PyBufferRegion *self, PyObject *args)
{
int y;
if (!PyArg_ParseTuple(args, "i:set_y", &y)) {
Expand All @@ -70,14 +70,14 @@ static PyObject *PyBufferRegion_set_y(PyBufferRegion *self, PyObject *args, PyOb
Py_RETURN_NONE;
}

static PyObject *PyBufferRegion_get_extents(PyBufferRegion *self, PyObject *args, PyObject *kwds)
static PyObject *PyBufferRegion_get_extents(PyBufferRegion *self, PyObject *args)
{
agg::rect_i rect = self->x->get_rect();

return Py_BuildValue("IIII", rect.x1, rect.y1, rect.x2, rect.y2);
}

static PyObject *PyBufferRegion_to_string_argb(PyBufferRegion *self, PyObject *args, PyObject *kwds)
static PyObject *PyBufferRegion_to_string_argb(PyBufferRegion *self, PyObject *args)
{
PyObject *bufobj;
uint8_t *buf;
Expand Down Expand Up @@ -198,7 +198,7 @@ static void PyRendererAgg_dealloc(PyRendererAgg *self)
Py_TYPE(self)->tp_free((PyObject *)self);
}

static PyObject *PyRendererAgg_draw_path(PyRendererAgg *self, PyObject *args, PyObject *kwds)
static PyObject *PyRendererAgg_draw_path(PyRendererAgg *self, PyObject *args)
{
GCAgg gc;
py::PathIterator path;
Expand Down Expand Up @@ -227,7 +227,7 @@ static PyObject *PyRendererAgg_draw_path(PyRendererAgg *self, PyObject *args, Py
Py_RETURN_NONE;
}

static PyObject *PyRendererAgg_draw_text_image(PyRendererAgg *self, PyObject *args, PyObject *kwds)
static PyObject *PyRendererAgg_draw_text_image(PyRendererAgg *self, PyObject *args)
{
numpy::array_view<agg::int8u, 2> image;
double x;
Expand All @@ -252,7 +252,7 @@ static PyObject *PyRendererAgg_draw_text_image(PyRendererAgg *self, PyObject *ar
Py_RETURN_NONE;
}

PyObject *PyRendererAgg_draw_markers(PyRendererAgg *self, PyObject *args, PyObject *kwds)
PyObject *PyRendererAgg_draw_markers(PyRendererAgg *self, PyObject *args)
{
GCAgg gc;
py::PathIterator marker_path;
Expand Down Expand Up @@ -288,7 +288,7 @@ PyObject *PyRendererAgg_draw_markers(PyRendererAgg *self, PyObject *args, PyObje
Py_RETURN_NONE;
}

static PyObject *PyRendererAgg_draw_image(PyRendererAgg *self, PyObject *args, PyObject *kwds)
static PyObject *PyRendererAgg_draw_image(PyRendererAgg *self, PyObject *args)
{
GCAgg gc;
double x;
Expand Down Expand Up @@ -316,7 +316,7 @@ static PyObject *PyRendererAgg_draw_image(PyRendererAgg *self, PyObject *args, P
}

static PyObject *
PyRendererAgg_draw_path_collection(PyRendererAgg *self, PyObject *args, PyObject *kwds)
PyRendererAgg_draw_path_collection(PyRendererAgg *self, PyObject *args)
{
GCAgg gc;
agg::trans_affine master_transform;
Expand Down Expand Up @@ -377,7 +377,7 @@ PyRendererAgg_draw_path_collection(PyRendererAgg *self, PyObject *args, PyObject
Py_RETURN_NONE;
}

static PyObject *PyRendererAgg_draw_quad_mesh(PyRendererAgg *self, PyObject *args, PyObject *kwds)
static PyObject *PyRendererAgg_draw_quad_mesh(PyRendererAgg *self, PyObject *args)
{
GCAgg gc;
agg::trans_affine master_transform;
Expand Down Expand Up @@ -429,7 +429,7 @@ static PyObject *PyRendererAgg_draw_quad_mesh(PyRendererAgg *self, PyObject *arg
}

static PyObject *
PyRendererAgg_draw_gouraud_triangle(PyRendererAgg *self, PyObject *args, PyObject *kwds)
PyRendererAgg_draw_gouraud_triangle(PyRendererAgg *self, PyObject *args)
{
GCAgg gc;
numpy::array_view<const double, 2> points;
Expand Down Expand Up @@ -470,7 +470,7 @@ PyRendererAgg_draw_gouraud_triangle(PyRendererAgg *self, PyObject *args, PyObjec
}

static PyObject *
PyRendererAgg_draw_gouraud_triangles(PyRendererAgg *self, PyObject *args, PyObject *kwds)
PyRendererAgg_draw_gouraud_triangles(PyRendererAgg *self, PyObject *args)
{
GCAgg gc;
numpy::array_view<const double, 3> points;
Expand Down Expand Up @@ -540,14 +540,14 @@ int PyRendererAgg_get_buffer(PyRendererAgg *self, Py_buffer *buf, int flags)
return 1;
}

static PyObject *PyRendererAgg_clear(PyRendererAgg *self, PyObject *args, PyObject *kwds)
static PyObject *PyRendererAgg_clear(PyRendererAgg *self, PyObject *args)
{
CALL_CPP("clear", self->x->clear());

Py_RETURN_NONE;
}

static PyObject *PyRendererAgg_copy_from_bbox(PyRendererAgg *self, PyObject *args, PyObject *kwds)
static PyObject *PyRendererAgg_copy_from_bbox(PyRendererAgg *self, PyObject *args)
{
agg::rect_d bbox;
BufferRegion *reg;
Expand All @@ -565,7 +565,7 @@ static PyObject *PyRendererAgg_copy_from_bbox(PyRendererAgg *self, PyObject *arg
return regobj;
}

static PyObject *PyRendererAgg_restore_region(PyRendererAgg *self, PyObject *args, PyObject *kwds)
static PyObject *PyRendererAgg_restore_region(PyRendererAgg *self, PyObject *args)
{
PyBufferRegion *regobj;
int xx1 = 0, yy1 = 0, xx2 = 0, yy2 = 0, x = 0, y = 0;
Expand Down
4 changes: 2 additions & 2 deletions src/_contour_wrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ const char* PyQuadContourGenerator_create_contour__doc__ =
"--\n\n"
"Create and return a non-filled contour.";

static PyObject* PyQuadContourGenerator_create_contour(PyQuadContourGenerator* self, PyObject* args, PyObject* kwds)
static PyObject* PyQuadContourGenerator_create_contour(PyQuadContourGenerator* self, PyObject* args)
{
double level;
if (!PyArg_ParseTuple(args, "d:create_contour", &level)) {
Expand All @@ -98,7 +98,7 @@ const char* PyQuadContourGenerator_create_filled_contour__doc__ =
"--\n\n"
"Create and return a filled contour";

static PyObject* PyQuadContourGenerator_create_filled_contour(PyQuadContourGenerator* self, PyObject* args, PyObject* kwds)
static PyObject* PyQuadContourGenerator_create_filled_contour(PyQuadContourGenerator* self, PyObject* args)
{
double lower_level, upper_level;
if (!PyArg_ParseTuple(args, "dd:create_filled_contour",
Expand Down
28 changes: 14 additions & 14 deletions src/_path_wrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ const char *Py_point_in_path__doc__ =
"point_in_path(x, y, radius, path, trans)\n"
"--\n\n";

static PyObject *Py_point_in_path(PyObject *self, PyObject *args, PyObject *kwds)
static PyObject *Py_point_in_path(PyObject *self, PyObject *args)
{
double x, y, r;
py::PathIterator path;
Expand Down Expand Up @@ -64,7 +64,7 @@ const char *Py_points_in_path__doc__ =
"points_in_path(points, radius, path, trans)\n"
"--\n\n";

static PyObject *Py_points_in_path(PyObject *self, PyObject *args, PyObject *kwds)
static PyObject *Py_points_in_path(PyObject *self, PyObject *args)
{
numpy::array_view<const double, 2> points;
double r;
Expand Down Expand Up @@ -95,7 +95,7 @@ const char *Py_point_on_path__doc__ =
"point_on_path(x, y, radius, path, trans)\n"
"--\n\n";

static PyObject *Py_point_on_path(PyObject *self, PyObject *args, PyObject *kwds)
static PyObject *Py_point_on_path(PyObject *self, PyObject *args)
{
double x, y, r;
py::PathIterator path;
Expand Down Expand Up @@ -127,7 +127,7 @@ const char *Py_points_on_path__doc__ =
"points_on_path(points, radius, path, trans)\n"
"--\n\n";

static PyObject *Py_points_on_path(PyObject *self, PyObject *args, PyObject *kwds)
static PyObject *Py_points_on_path(PyObject *self, PyObject *args)
{
numpy::array_view<const double, 2> points;
double r;
Expand Down Expand Up @@ -158,7 +158,7 @@ const char *Py_get_path_extents__doc__ =
"get_path_extents(path, trans)\n"
"--\n\n";

static PyObject *Py_get_path_extents(PyObject *self, PyObject *args, PyObject *kwds)
static PyObject *Py_get_path_extents(PyObject *self, PyObject *args)
{
py::PathIterator path;
agg::trans_affine trans;
Expand Down Expand Up @@ -187,7 +187,7 @@ const char *Py_update_path_extents__doc__ =
"update_path_extents(path, trans, rect, minpos, ignore)\n"
"--\n\n";

static PyObject *Py_update_path_extents(PyObject *self, PyObject *args, PyObject *kwds)
static PyObject *Py_update_path_extents(PyObject *self, PyObject *args)
{
py::PathIterator path;
agg::trans_affine trans;
Expand Down Expand Up @@ -266,7 +266,7 @@ const char *Py_get_path_collection_extents__doc__ =
"master_transform, paths, transforms, offsets, offset_transform)\n"
"--\n\n";

static PyObject *Py_get_path_collection_extents(PyObject *self, PyObject *args, PyObject *kwds)
static PyObject *Py_get_path_collection_extents(PyObject *self, PyObject *args)
{
agg::trans_affine master_transform;
py::PathGenerator paths;
Expand Down Expand Up @@ -315,7 +315,7 @@ const char *Py_point_in_path_collection__doc__ =
"offset_trans, filled)\n"
"--\n\n";

static PyObject *Py_point_in_path_collection(PyObject *self, PyObject *args, PyObject *kwds)
static PyObject *Py_point_in_path_collection(PyObject *self, PyObject *args)
{
double x, y, radius;
agg::trans_affine master_transform;
Expand Down Expand Up @@ -370,7 +370,7 @@ const char *Py_path_in_path__doc__ =
"path_in_path(path_a, trans_a, path_b, trans_b)\n"
"--\n\n";

static PyObject *Py_path_in_path(PyObject *self, PyObject *args, PyObject *kwds)
static PyObject *Py_path_in_path(PyObject *self, PyObject *args)
{
py::PathIterator a;
agg::trans_affine atrans;
Expand Down Expand Up @@ -404,7 +404,7 @@ const char *Py_clip_path_to_rect__doc__ =
"clip_path_to_rect(path, rect, inside)\n"
"--\n\n";

static PyObject *Py_clip_path_to_rect(PyObject *self, PyObject *args, PyObject *kwds)
static PyObject *Py_clip_path_to_rect(PyObject *self, PyObject *args)
{
py::PathIterator path;
agg::rect_d rect;
Expand All @@ -431,7 +431,7 @@ const char *Py_affine_transform__doc__ =
"affine_transform(points, trans)\n"
"--\n\n";

static PyObject *Py_affine_transform(PyObject *self, PyObject *args, PyObject *kwds)
static PyObject *Py_affine_transform(PyObject *self, PyObject *args)
{
PyObject *vertices_obj;
agg::trans_affine trans;
Expand Down Expand Up @@ -472,7 +472,7 @@ const char *Py_count_bboxes_overlapping_bbox__doc__ =
"count_bboxes_overlapping_bbox(bbox, bboxes)\n"
"--\n\n";

static PyObject *Py_count_bboxes_overlapping_bbox(PyObject *self, PyObject *args, PyObject *kwds)
static PyObject *Py_count_bboxes_overlapping_bbox(PyObject *self, PyObject *args)
{
agg::rect_d bbox;
numpy::array_view<const double, 3> bboxes;
Expand Down Expand Up @@ -614,7 +614,7 @@ const char *Py_cleanup_path__doc__ =
"return_curves, sketch)\n"
"--\n\n";

static PyObject *Py_cleanup_path(PyObject *self, PyObject *args, PyObject *kwds)
static PyObject *Py_cleanup_path(PyObject *self, PyObject *args)
{
py::PathIterator path;
agg::trans_affine trans;
Expand Down Expand Up @@ -721,7 +721,7 @@ const char *Py_convert_to_string__doc__ =
" Whether the opcode comes after the values (True) or before (False).\n"
;

static PyObject *Py_convert_to_string(PyObject *self, PyObject *args, PyObject *kwds)
static PyObject *Py_convert_to_string(PyObject *self, PyObject *args)
{
py::PathIterator path;
agg::trans_affine trans;
Expand Down