Skip to content

Commit 049bcf0

Browse files
committed
(F)Rect.inflate(_ip) FASTCALL
1 parent 7896a55 commit 049bcf0

File tree

2 files changed

+14
-12
lines changed

2 files changed

+14
-12
lines changed

src_c/rect.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -471,13 +471,13 @@ static struct PyMethodDef pg_rect_methods[] = {
471471
{"fit", (PyCFunction)pg_rect_fit, METH_FASTCALL, DOC_RECT_FIT},
472472
{"move", (PyCFunction)pg_rect_move, METH_FASTCALL, DOC_RECT_MOVE},
473473
{"update", (PyCFunction)pg_rect_update, METH_FASTCALL, DOC_RECT_UPDATE},
474-
{"inflate", (PyCFunction)pg_rect_inflate, METH_VARARGS, DOC_RECT_INFLATE},
474+
{"inflate", (PyCFunction)pg_rect_inflate, METH_FASTCALL, DOC_RECT_INFLATE},
475475
{"union", (PyCFunction)pg_rect_union, METH_FASTCALL, DOC_RECT_UNION},
476476
{"unionall", (PyCFunction)pg_rect_unionall, METH_O, DOC_RECT_UNIONALL},
477477
{"move_ip", (PyCFunction)pg_rect_move_ip, METH_FASTCALL, DOC_RECT_MOVEIP},
478478
{"move_to", (PyCFunction)pg_rect_move_to, METH_FASTCALL | METH_KEYWORDS,
479479
DOC_RECT_MOVETO},
480-
{"inflate_ip", (PyCFunction)pg_rect_inflate_ip, METH_VARARGS,
480+
{"inflate_ip", (PyCFunction)pg_rect_inflate_ip, METH_FASTCALL,
481481
DOC_RECT_INFLATEIP},
482482
{"scale_by", (PyCFunction)pg_rect_scale_by, METH_VARARGS | METH_KEYWORDS,
483483
DOC_RECT_SCALEBY},
@@ -522,13 +522,14 @@ static struct PyMethodDef pg_frect_methods[] = {
522522
{"fit", (PyCFunction)pg_frect_fit, METH_FASTCALL, DOC_RECT_FIT},
523523
{"move", (PyCFunction)pg_frect_move, METH_FASTCALL, DOC_RECT_MOVE},
524524
{"update", (PyCFunction)pg_frect_update, METH_FASTCALL, DOC_RECT_UPDATE},
525-
{"inflate", (PyCFunction)pg_frect_inflate, METH_VARARGS, DOC_RECT_INFLATE},
525+
{"inflate", (PyCFunction)pg_frect_inflate, METH_FASTCALL,
526+
DOC_RECT_INFLATE},
526527
{"union", (PyCFunction)pg_frect_union, METH_FASTCALL, DOC_RECT_UNION},
527528
{"unionall", (PyCFunction)pg_frect_unionall, METH_O, DOC_RECT_UNIONALL},
528529
{"move_ip", (PyCFunction)pg_frect_move_ip, METH_FASTCALL, DOC_RECT_MOVEIP},
529530
{"move_to", (PyCFunction)pg_frect_move_to, METH_FASTCALL | METH_KEYWORDS,
530531
DOC_RECT_MOVETO},
531-
{"inflate_ip", (PyCFunction)pg_frect_inflate_ip, METH_VARARGS,
532+
{"inflate_ip", (PyCFunction)pg_frect_inflate_ip, METH_FASTCALL,
532533
DOC_RECT_INFLATEIP},
533534
{"scale_by", (PyCFunction)pg_frect_scale_by, METH_VARARGS | METH_KEYWORDS,
534535
DOC_RECT_SCALEBY},

src_c/rect_impl.h

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -465,9 +465,10 @@ static PyObject *
465465
RectExport_moveTo(RectObject *self, PyObject *const *args, Py_ssize_t nargs,
466466
PyObject *kwnames);
467467
static PyObject *
468-
RectExport_inflate(RectObject *self, PyObject *args);
468+
RectExport_inflate(RectObject *self, PyObject *const *args, Py_ssize_t nargs);
469469
static PyObject *
470-
RectExport_inflateIp(RectObject *self, PyObject *args);
470+
RectExport_inflateIp(RectObject *self, PyObject *const *args,
471+
Py_ssize_t nargs);
471472
static PyObject *
472473
RectExport_scalebyIp(RectObject *self, PyObject *args, PyObject *kwargs);
473474
static PyObject *
@@ -1052,12 +1053,12 @@ RectExport_moveTo(RectObject *self, PyObject *const *args, Py_ssize_t nargs,
10521053
}
10531054

10541055
static PyObject *
1055-
RectExport_inflate(RectObject *self, PyObject *args)
1056+
RectExport_inflate(RectObject *self, PyObject *const *args, Py_ssize_t nargs)
10561057
{
10571058
PrimitiveType x, y;
10581059

1059-
if (!twoPrimitivesFromObj(args, &x, &y)) {
1060-
return RAISE(PyExc_TypeError, "argument must contain two numbers");
1060+
if (!pgTwoValuesFromFastcallArgs(args, nargs, &x, &y)) {
1061+
return NULL;
10611062
}
10621063

10631064
return RectExport_subtypeNew4(Py_TYPE(self), self->r.x - x / 2,
@@ -1066,12 +1067,12 @@ RectExport_inflate(RectObject *self, PyObject *args)
10661067
}
10671068

10681069
static PyObject *
1069-
RectExport_inflateIp(RectObject *self, PyObject *args)
1070+
RectExport_inflateIp(RectObject *self, PyObject *const *args, Py_ssize_t nargs)
10701071
{
10711072
PrimitiveType x, y;
10721073

1073-
if (!twoPrimitivesFromObj(args, &x, &y)) {
1074-
return RAISE(PyExc_TypeError, "argument must contain two numbers");
1074+
if (!pgTwoValuesFromFastcallArgs(args, nargs, &x, &y)) {
1075+
return NULL;
10751076
}
10761077
self->r.x -= x / 2;
10771078
self->r.y -= y / 2;

0 commit comments

Comments
 (0)