Skip to content

Commit 78510f5

Browse files
committed
Rename to PyArg_ParseArray()
1 parent d0cad25 commit 78510f5

File tree

5 files changed

+22
-22
lines changed

5 files changed

+22
-22
lines changed

Doc/c-api/arg.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -516,7 +516,7 @@ API Functions
516516
}
517517
518518
519-
.. c:function:: int PyArg_ParseVector(PyObject *const *args, Py_ssize_t nargs, const char *format, ...)
519+
.. c:function:: int PyArg_ParseArray(PyObject *const *args, Py_ssize_t nargs, const char *format, ...)
520520
521521
Parse the parameters of a function that takes only vector parameters into
522522
local variables (that is, a function using the :c:macro:`METH_FASTCALL`
@@ -527,7 +527,7 @@ API Functions
527527
.. versionadded:: next
528528
529529
530-
.. c:function:: int PyArg_ParseVectorAndKeywords(PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames, const char *format, const char * const *kwlist, ...)
530+
.. c:function:: int PyArg_ParseArrayAndKeywords(PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames, const char *format, const char * const *kwlist, ...)
531531
532532
Parse the parameters of a function that takes both vector and keyword
533533
parameters into local variables (that is, a function using the

Include/cpython/modsupport.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@
22
# error "this header file must not be included directly"
33
#endif
44

5-
PyAPI_FUNC(int) PyArg_ParseVector(
5+
PyAPI_FUNC(int) PyArg_ParseArray(
66
PyObject *const *args,
77
Py_ssize_t nargs,
88
const char *format,
99
...);
10-
PyAPI_FUNC(int) PyArg_ParseVectorAndKeywords(
10+
PyAPI_FUNC(int) PyArg_ParseArrayAndKeywords(
1111
PyObject *const *args,
1212
Py_ssize_t nargs,
1313
PyObject *kwnames,

Lib/test/test_capi/test_modsupport.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -155,15 +155,15 @@ def test_negative_freethreading(self, modname, minor, build):
155155

156156

157157
class TestModsupport(unittest.TestCase):
158-
def test_pyarg_parsevector(self):
159-
func = _testcapi.pyarg_parsevector
158+
def test_pyarg_parsearray(self):
159+
func = _testcapi.pyarg_parsearray
160160
self.assertEqual(func(1, 2), (1, 2, 0))
161161
self.assertEqual(func(1, 2, 3), (1, 2, 3))
162162
self.assertRaises(TypeError, func, 1)
163163
self.assertRaises(TypeError, func, "str", 2)
164164

165165
def test_funcandkeywords(self):
166-
func = _testcapi.pyarg_parsevectorandkeywords
166+
func = _testcapi.pyarg_parsearrayandkeywords
167167
self.assertEqual(func(1, 2), (1, 2, 0))
168168
self.assertEqual(func(1, 2, 3), (1, 2, 3))
169169
self.assertEqual(func(1, b=2), (1, 2, 0))

Modules/_testcapi/modsupport.c

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -26,34 +26,34 @@ pyabiinfo_check(PyObject *Py_UNUSED(module), PyObject *args)
2626
}
2727

2828
static PyObject *
29-
pyarg_parsevector(PyObject* self, PyObject* const* args, Py_ssize_t nargs)
29+
pyarg_parsearray(PyObject* self, PyObject* const* args, Py_ssize_t nargs)
3030
{
3131
int a, b, c = 0;
32-
if (!PyArg_ParseVector(args, nargs, "ii|i", &a, &b, &c)) {
32+
if (!PyArg_ParseArray(args, nargs, "ii|i", &a, &b, &c)) {
3333
return NULL;
3434
}
3535
return Py_BuildValue("iii", a, b, c);
3636
}
3737

3838
static PyObject *
39-
pyarg_parsevectorandkeywords(PyObject* self, PyObject* const* args,
40-
Py_ssize_t nargs, PyObject* kwnames)
39+
pyarg_parsearrayandkeywords(PyObject* self, PyObject* const* args,
40+
Py_ssize_t nargs, PyObject* kwnames)
4141
{
4242
int a, b, c = 0;
4343
const char *kwlist[] = {"a", "b", "c", NULL};
44-
if (!PyArg_ParseVectorAndKeywords(args, nargs, kwnames,
45-
"ii|i", kwlist,
46-
&a, &b, &c)) {
44+
if (!PyArg_ParseArrayAndKeywords(args, nargs, kwnames,
45+
"ii|i", kwlist,
46+
&a, &b, &c)) {
4747
return NULL;
4848
}
4949
return Py_BuildValue("iii", a, b, c);
5050
}
5151

5252
static PyMethodDef TestMethods[] = {
5353
{"pyabiinfo_check", pyabiinfo_check, METH_VARARGS},
54-
{"pyarg_parsevector", _PyCFunction_CAST(pyarg_parsevector), METH_FASTCALL},
55-
{"pyarg_parsevectorandkeywords",
56-
_PyCFunction_CAST(pyarg_parsevectorandkeywords),
54+
{"pyarg_parsearray", _PyCFunction_CAST(pyarg_parsearray), METH_FASTCALL},
55+
{"pyarg_parsearrayandkeywords",
56+
_PyCFunction_CAST(pyarg_parsearrayandkeywords),
5757
METH_FASTCALL | METH_KEYWORDS},
5858
{NULL},
5959
};

Python/getargs.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ _PyArg_ParseStack(PyObject *const *args, Py_ssize_t nargs, const char *format, .
137137
}
138138

139139
int
140-
PyArg_ParseVector(PyObject *const *args, Py_ssize_t nargs, const char *format, ...)
140+
PyArg_ParseArray(PyObject *const *args, Py_ssize_t nargs, const char *format, ...)
141141
{
142142
va_list va;
143143
va_start(va, format);
@@ -147,10 +147,10 @@ PyArg_ParseVector(PyObject *const *args, Py_ssize_t nargs, const char *format, .
147147
}
148148

149149
int
150-
PyArg_ParseVectorAndKeywords(PyObject *const *args, Py_ssize_t nargs,
151-
PyObject *kwnames,
152-
const char *format,
153-
const char * const *kwlist, ...)
150+
PyArg_ParseArrayAndKeywords(PyObject *const *args, Py_ssize_t nargs,
151+
PyObject *kwnames,
152+
const char *format,
153+
const char * const *kwlist, ...)
154154
{
155155
if ((args == NULL && nargs != 0) ||
156156
(kwnames != NULL && !PyTuple_Check(kwnames)) ||

0 commit comments

Comments
 (0)