Skip to content

Commit 7ed7148

Browse files
committed
Make test shut up check-c-globals.py
1 parent 19c93f3 commit 7ed7148

1 file changed

Lines changed: 3 additions & 17 deletions

File tree

Modules/_testinternalcapi/test_ptr_wise_memmove.c

Lines changed: 3 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,9 @@
77
// Five distinguishable immortal singletons used as placeholder pointers.
88
// These require no reference-count management when stored in a raw array.
99
#define NPTRS 5
10-
static PyObject *test_objs[NPTRS];
11-
12-
static void
13-
setup_test_objs(void)
14-
{
15-
test_objs[0] = Py_None;
16-
test_objs[1] = Py_True;
17-
test_objs[2] = Py_False;
18-
test_objs[3] = Py_Ellipsis;
19-
test_objs[4] = Py_NotImplemented;
20-
}
21-
10+
const static PyObject *test_objs[NPTRS] = {
11+
Py_None, Py_True, Py_False, Py_Ellipsis, Py_NotImplemented
12+
};
2213
// Fill buf[0..NPTRS-1] with test_objs in order.
2314
static void
2415
fill_buf(PyObject **buf)
@@ -64,7 +55,6 @@ call_memmove(PyObject **dest, PyObject **src, Py_ssize_t n)
6455
static PyObject *
6556
test_memmove_dest_lt_src(PyObject *self, PyObject *Py_UNUSED(arg))
6657
{
67-
setup_test_objs();
6858

6959
PyObject *buf[NPTRS];
7060
fill_buf(buf);
@@ -90,7 +80,6 @@ test_memmove_dest_lt_src(PyObject *self, PyObject *Py_UNUSED(arg))
9080
static PyObject *
9181
test_memmove_dest_gt_src(PyObject *self, PyObject *Py_UNUSED(arg))
9282
{
93-
setup_test_objs();
9483

9584
PyObject *buf[NPTRS];
9685
fill_buf(buf);
@@ -116,7 +105,6 @@ test_memmove_dest_gt_src(PyObject *self, PyObject *Py_UNUSED(arg))
116105
static PyObject *
117106
test_memmove_dest_eq_src(PyObject *self, PyObject *Py_UNUSED(arg))
118107
{
119-
setup_test_objs();
120108

121109
PyObject *buf[NPTRS];
122110
fill_buf(buf);
@@ -141,7 +129,6 @@ test_memmove_dest_eq_src(PyObject *self, PyObject *Py_UNUSED(arg))
141129
static PyObject *
142130
test_memmove_overlapping(PyObject *self, PyObject *Py_UNUSED(arg))
143131
{
144-
setup_test_objs();
145132

146133
PyObject *buf[NPTRS];
147134
fill_buf(buf);
@@ -168,7 +155,6 @@ test_memmove_overlapping(PyObject *self, PyObject *Py_UNUSED(arg))
168155
static PyObject *
169156
test_memmove_single_owner(PyObject *self, PyObject *Py_UNUSED(arg))
170157
{
171-
setup_test_objs();
172158

173159
PyObject *a = PyList_New(0);
174160
if (a == NULL) {

0 commit comments

Comments
 (0)