@@ -813,10 +813,8 @@ list_repeat_lock_held(PyListObject *a, Py_ssize_t n)
813813 _Py_RefcntAdd (* src , n );
814814 * dest ++ = * src ++ ;
815815 }
816- // TODO: _Py_memory_repeat calls are not safe for shared lists in
817- // GIL_DISABLED builds. (See issue #129069)
818- _Py_memory_repeat ((char * )np -> ob_item , sizeof (PyObject * )* output_size ,
819- sizeof (PyObject * )* input_size );
816+ _Py_memory_ptrs_repeat ((char * )np -> ob_item , sizeof (PyObject * )* output_size ,
817+ sizeof (PyObject * )* input_size );
820818 }
821819
822820 Py_SET_SIZE (np , output_size );
@@ -949,12 +947,10 @@ list_ass_slice_lock_held(PyListObject *a, Py_ssize_t ilow, Py_ssize_t ihigh, PyO
949947 if (d < 0 ) { /* Delete -d items */
950948 Py_ssize_t tail ;
951949 tail = (Py_SIZE (a ) - ihigh ) * sizeof (PyObject * );
952- // TODO: these memmove/memcpy calls are not safe for shared lists in
953- // GIL_DISABLED builds. (See issue #129069)
954- memmove (& item [ihigh + d ], & item [ihigh ], tail );
950+ FT_ATOMIC_MEMMOVE_PTR_RELAXED (& item [ihigh + d ], & item [ihigh ], tail );
955951 if (list_resize (a , Py_SIZE (a ) + d ) < 0 ) {
956- memmove (& item [ihigh ], & item [ihigh + d ], tail );
957- memcpy (& item [ilow ], recycle , s );
952+ FT_ATOMIC_MEMMOVE_PTR_RELAXED (& item [ihigh ], & item [ihigh + d ], tail );
953+ FT_ATOMIC_MEMCPY_PTR_RELAXED (& item [ilow ], recycle , s );
958954 goto Error ;
959955 }
960956 item = a -> ob_item ;
@@ -964,10 +960,8 @@ list_ass_slice_lock_held(PyListObject *a, Py_ssize_t ilow, Py_ssize_t ihigh, PyO
964960 if (list_resize (a , k + d ) < 0 )
965961 goto Error ;
966962 item = a -> ob_item ;
967- // TODO: these memmove/memcpy calls are not safe for shared lists in
968- // GIL_DISABLED builds. (See issue #129069)
969- memmove (& item [ihigh + d ], & item [ihigh ],
970- (k - ihigh )* sizeof (PyObject * ));
963+ FT_ATOMIC_MEMMOVE_PTR_RELAXED (& item [ihigh + d ], & item [ihigh ],
964+ (k - ihigh )* sizeof (PyObject * ));
971965 }
972966 for (k = 0 ; k < n ; k ++ , ilow ++ ) {
973967 PyObject * w = vitem [k ];
@@ -1051,10 +1045,8 @@ list_inplace_repeat_lock_held(PyListObject *self, Py_ssize_t n)
10511045 for (Py_ssize_t j = 0 ; j < input_size ; j ++ ) {
10521046 _Py_RefcntAdd (items [j ], n - 1 );
10531047 }
1054- // TODO: _Py_memory_repeat calls are not safe for shared lists in
1055- // GIL_DISABLED builds. (See issue #129069)
1056- _Py_memory_repeat ((char * )items , sizeof (PyObject * )* output_size ,
1057- sizeof (PyObject * )* input_size );
1048+ _Py_memory_ptrs_repeat ((char * )items , sizeof (PyObject * )* output_size ,
1049+ sizeof (PyObject * )* input_size );
10581050 return 0 ;
10591051}
10601052
0 commit comments