Skip to content

Commit 2e683e5

Browse files
committed
Rename to _PyObject_ptr_wise_atomic_memmove
1 parent 459a7e7 commit 2e683e5

3 files changed

Lines changed: 15 additions & 13 deletions

File tree

Include/internal/pycore_object.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1042,7 +1042,7 @@ PyAPI_FUNC(int) _PyObject_VisitType(PyObject *op, visitproc visit, void *arg);
10421042
// Pointer-by-pointer memmove for PyObject** arrays that is safe for shared
10431043
// objects in Py_GIL_DISABLED builds. Locking is the caller's responsibility.
10441044
static inline void
1045-
_Py_ptr_wise_atomic_memmove(PyObject *a, PyObject **dest, PyObject **src,
1045+
_PyObject_ptr_wise_atomic_memmove(PyObject *a, PyObject **dest, PyObject **src,
10461046
Py_ssize_t n)
10471047
{
10481048
#ifndef Py_GIL_DISABLED
@@ -1068,6 +1068,8 @@ _Py_ptr_wise_atomic_memmove(PyObject *a, PyObject **dest, PyObject **src,
10681068
#endif
10691069
}
10701070

1071+
#define _PyObject_ptr_wise_atomic_memmove(a, dest, src, n) _PyObject_ptr_wise_atomic_memmove(_PyObject_CAST(a), dest, src, n)
1072+
10711073
#ifdef __cplusplus
10721074
}
10731075
#endif

Modules/_elementtree.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
#include "Python.h"
1919
#include "pycore_ceval.h" // _Py_EnterRecursiveCall()
2020
#include "pycore_dict.h" // _PyDict_CopyAsDict()
21-
#include "pycore_object.h" // _Py_ptr_wise_atomic_memmove()
21+
#include "pycore_object.h" // _PyObject_ptr_wise_atomic_memmove()
2222
#include "pycore_pyhash.h" // _Py_HashSecret
2323
#include "pycore_tuple.h" // _PyTuple_FromPair
2424
#include "pycore_weakref.h" // FT_CLEAR_WEAKREFS()
@@ -1940,8 +1940,8 @@ element_ass_subscr(PyObject *op, PyObject *item, PyObject *value)
19401940

19411941
PyList_SET_ITEM(recycle, i, self->extra->children[cur]);
19421942

1943-
_Py_ptr_wise_atomic_memmove(
1944-
(PyObject *)self,
1943+
_PyObject_ptr_wise_atomic_memmove(
1944+
self,
19451945
self->extra->children + cur - i,
19461946
self->extra->children + cur + 1,
19471947
num_moved);
@@ -1950,8 +1950,8 @@ element_ass_subscr(PyObject *op, PyObject *item, PyObject *value)
19501950
/* Leftover "tail" after the last removed child */
19511951
cur = start + (size_t)slicelen * step;
19521952
if (cur < (size_t)self->extra->length) {
1953-
_Py_ptr_wise_atomic_memmove(
1954-
(PyObject *)self,
1953+
_PyObject_ptr_wise_atomic_memmove(
1954+
self,
19551955
self->extra->children + cur - slicelen,
19561956
self->extra->children + cur,
19571957
self->extra->length - cur);

Objects/listobject.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
#include "pycore_list.h" // struct _Py_list_freelist, _PyListIterObject
1111
#include "pycore_long.h" // _PyLong_DigitCount
1212
#include "pycore_modsupport.h" // _PyArg_NoKwnames()
13-
#include "pycore_object.h" // _PyObject_GC_TRACK(), _Py_ptr_wise_atomic_memmove()
13+
#include "pycore_object.h" // _PyObject_GC_TRACK(), _PyObject_ptr_wise_atomic_memmove()
1414
#include "pycore_pyatomic_ft_wrappers.h"
1515
#include "pycore_setobject.h" // _PySet_NextEntry()
1616
#include "pycore_stackref.h" // _Py_TryIncrefCompareStackRef()
@@ -985,7 +985,7 @@ list_ass_slice_lock_held(PyListObject *a, Py_ssize_t ilow, Py_ssize_t ihigh, PyO
985985
if (d < 0) { /* Delete -d items */
986986
Py_ssize_t tail = Py_SIZE(a) - ihigh;
987987
_Py_CRITICAL_SECTION_ASSERT_OBJECT_LOCKED(a);
988-
_Py_ptr_wise_atomic_memmove((PyObject *)a, &item[ihigh+d], &item[ihigh], tail);
988+
_PyObject_ptr_wise_atomic_memmove(a, &item[ihigh+d], &item[ihigh], tail);
989989
(void)list_resize(a, Py_SIZE(a) + d); // NB: shrinking a list can't fail
990990
item = a->ob_item;
991991
}
@@ -995,7 +995,7 @@ list_ass_slice_lock_held(PyListObject *a, Py_ssize_t ilow, Py_ssize_t ihigh, PyO
995995
goto Error;
996996
item = a->ob_item;
997997
_Py_CRITICAL_SECTION_ASSERT_OBJECT_LOCKED(a);
998-
_Py_ptr_wise_atomic_memmove((PyObject *)a, &item[ihigh+d], &item[ihigh], k - ihigh);
998+
_PyObject_ptr_wise_atomic_memmove(a, &item[ihigh+d], &item[ihigh], k - ihigh);
999999
}
10001000
for (k = 0; k < n; k++, ilow++) {
10011001
PyObject *w = vitem[k];
@@ -1087,7 +1087,7 @@ list_inplace_repeat_lock_held(PyListObject *self, Py_ssize_t n)
10871087
Py_ssize_t copied = input_size;
10881088
while (copied < output_size) {
10891089
Py_ssize_t items_to_copy = Py_MIN(copied, output_size - copied);
1090-
_Py_ptr_wise_atomic_memmove((PyObject *)self, items + copied, items, items_to_copy);
1090+
_PyObject_ptr_wise_atomic_memmove(self, items + copied, items, items_to_copy);
10911091
copied += items_to_copy;
10921092
}
10931093
#endif
@@ -1586,7 +1586,7 @@ list_pop_impl(PyListObject *self, Py_ssize_t index)
15861586
Py_ssize_t size_after_pop = Py_SIZE(self) - 1;
15871587
if (index < size_after_pop) {
15881588
_Py_CRITICAL_SECTION_ASSERT_OBJECT_LOCKED(self);
1589-
_Py_ptr_wise_atomic_memmove((PyObject *)self, &items[index], &items[index+1],
1589+
_PyObject_ptr_wise_atomic_memmove(self, &items[index], &items[index+1],
15901590
size_after_pop - index);
15911591
}
15921592
list_resize(self, size_after_pop); // NB: shrinking a list can't fail
@@ -3771,13 +3771,13 @@ list_ass_subscript_lock_held(PyObject *_self, PyObject *item, PyObject *value)
37713771
}
37723772

37733773
_Py_CRITICAL_SECTION_ASSERT_OBJECT_LOCKED(self);
3774-
_Py_ptr_wise_atomic_memmove((PyObject *)self, self->ob_item + cur - i,
3774+
_PyObject_ptr_wise_atomic_memmove(self, self->ob_item + cur - i,
37753775
self->ob_item + cur + 1, lim);
37763776
}
37773777
cur = start + (size_t)slicelength * step;
37783778
if (cur < (size_t)Py_SIZE(self)) {
37793779
_Py_CRITICAL_SECTION_ASSERT_OBJECT_LOCKED(self);
3780-
_Py_ptr_wise_atomic_memmove((PyObject *)self, self->ob_item + cur - slicelength,
3780+
_PyObject_ptr_wise_atomic_memmove(self, self->ob_item + cur - slicelength,
37813781
self->ob_item + cur, Py_SIZE(self) - cur);
37823782
}
37833783

0 commit comments

Comments
 (0)