Skip to content

Commit 18b1aac

Browse files
committed
Revert previous changes
1 parent c15572a commit 18b1aac

1 file changed

Lines changed: 17 additions & 3 deletions

File tree

Modules/_testinternalcapi/test_ptr_wise_memmove.c

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,18 @@
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-
Py_None, Py_True, Py_False, Py_Ellipsis, Py_NotImplemented
12-
};
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+
1322
// Fill buf[0..NPTRS-1] with test_objs in order.
1423
static void
1524
fill_buf(PyObject **buf)
@@ -55,6 +64,7 @@ call_memmove(PyObject **dest, PyObject **src, Py_ssize_t n)
5564
static PyObject *
5665
test_memmove_dest_lt_src(PyObject *self, PyObject *Py_UNUSED(arg))
5766
{
67+
setup_test_objs();
5868

5969
PyObject *buf[NPTRS];
6070
fill_buf(buf);
@@ -80,6 +90,7 @@ test_memmove_dest_lt_src(PyObject *self, PyObject *Py_UNUSED(arg))
8090
static PyObject *
8191
test_memmove_dest_gt_src(PyObject *self, PyObject *Py_UNUSED(arg))
8292
{
93+
setup_test_objs();
8394

8495
PyObject *buf[NPTRS];
8596
fill_buf(buf);
@@ -105,6 +116,7 @@ test_memmove_dest_gt_src(PyObject *self, PyObject *Py_UNUSED(arg))
105116
static PyObject *
106117
test_memmove_dest_eq_src(PyObject *self, PyObject *Py_UNUSED(arg))
107118
{
119+
setup_test_objs();
108120

109121
PyObject *buf[NPTRS];
110122
fill_buf(buf);
@@ -129,6 +141,7 @@ test_memmove_dest_eq_src(PyObject *self, PyObject *Py_UNUSED(arg))
129141
static PyObject *
130142
test_memmove_overlapping(PyObject *self, PyObject *Py_UNUSED(arg))
131143
{
144+
setup_test_objs();
132145

133146
PyObject *buf[NPTRS];
134147
fill_buf(buf);
@@ -155,6 +168,7 @@ test_memmove_overlapping(PyObject *self, PyObject *Py_UNUSED(arg))
155168
static PyObject *
156169
test_memmove_single_owner(PyObject *self, PyObject *Py_UNUSED(arg))
157170
{
171+
setup_test_objs();
158172

159173
PyObject *a = PyList_New(0);
160174
if (a == NULL) {

0 commit comments

Comments
 (0)