Skip to content

Commit caad089

Browse files
committed
Exchange also parameters in tests
1 parent 21cf31c commit caad089

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

Lib/test/test_capi/test_tuple.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -67,22 +67,22 @@ def test_tuple_fromarray(self):
6767
tuple_fromarray = _testcapi.tuple_fromarray
6868

6969
tup = tuple([i] for i in range(5))
70-
copy = tuple_fromarray(tup)
70+
copy = tuple_fromarray(len(tup), tup)
7171
self.assertEqual(copy, tup)
7272

7373
tup = ()
74-
copy = tuple_fromarray(tup)
74+
copy = tuple_fromarray(0, tup)
7575
self.assertIs(copy, tup)
7676

77-
copy = tuple_fromarray(NULL, 0)
77+
copy = tuple_fromarray(0, NULL)
7878
self.assertIs(copy, ())
7979

8080
with self.assertRaises(SystemError):
81-
tuple_fromarray(NULL, -1)
81+
tuple_fromarray(-1, NULL)
8282
with self.assertRaises(SystemError):
83-
tuple_fromarray(NULL, PY_SSIZE_T_MIN)
83+
tuple_fromarray(PY_SSIZE_T_MIN, NULL)
8484
with self.assertRaises(MemoryError):
85-
tuple_fromarray(NULL, PY_SSIZE_T_MAX)
85+
tuple_fromarray(PY_SSIZE_T_MAX, NULL)
8686

8787
def test_tuple_pack(self):
8888
# Test PyTuple_Pack()

Modules/_testcapi/tuple.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,9 +107,9 @@ _check_tuple_item_is_NULL(PyObject *Py_UNUSED(module), PyObject *args)
107107
static PyObject *
108108
tuple_fromarray(PyObject* Py_UNUSED(module), PyObject *args)
109109
{
110+
Py_ssize_t size;
110111
PyObject *src;
111-
Py_ssize_t size = UNINITIALIZED_SIZE;
112-
if (!PyArg_ParseTuple(args, "O|n", &src, &size)) {
112+
if (!PyArg_ParseTuple(args, "nO", &size, &src)) {
113113
return NULL;
114114
}
115115
if (src != Py_None && !PyTuple_Check(src)) {

0 commit comments

Comments
 (0)