Skip to content

Commit fff827e

Browse files
committed
use proper type FT_ macros
1 parent 51135a4 commit fff827e

File tree

2 files changed

+12
-10
lines changed

2 files changed

+12
-10
lines changed

Lib/test/test_array.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1954,6 +1954,8 @@ def iter_reduce(b, a, it):
19541954
self.check([clear] + [iter_next] * 10, a := array.array('i', [1] * 10), iter(a))
19551955

19561956
@unittest.skipUnless(support.check_sanitizer(thread=True), 'meant for tsan')
1957+
@threading_helper.reap_threads
1958+
@threading_helper.requires_working_threading()
19571959
def test_free_threading_tsan(self):
19581960
def copy_back_and_forth(b, a, count):
19591961
b.wait()

Modules/arraymodule.c

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -397,7 +397,7 @@ static PyObject *
397397
BB_getitem(char *items, Py_ssize_t i)
398398
{
399399
return PyLong_FromLong(
400-
(long) (unsigned char) FT_ATOMIC_LOAD_CHAR_RELAXED(items[i]));
400+
(long) FT_ATOMIC_LOAD_UCHAR_RELAXED(((unsigned char *) items)[i]));
401401
}
402402

403403
static int
@@ -409,7 +409,7 @@ BB_setitem(char *items, Py_ssize_t i, PyObject *v)
409409
return -1;
410410
}
411411
if (i >= 0) {
412-
FT_ATOMIC_STORE_CHAR_RELAXED(items[i], x);
412+
FT_ATOMIC_STORE_UCHAR_RELAXED(((unsigned char *) items)[i], x);
413413
}
414414
return 0;
415415
}
@@ -525,7 +525,7 @@ static PyObject *
525525
HH_getitem(char *items, Py_ssize_t i)
526526
{
527527
return PyLong_FromLong(
528-
(long) (unsigned short) FT_ATOMIC_LOAD_SHORT_RELAXED(((short *) items)[i]));
528+
(long) FT_ATOMIC_LOAD_USHORT_RELAXED(((unsigned short *) items)[i]));
529529
}
530530

531531
static int
@@ -548,7 +548,7 @@ HH_setitem(char *items, Py_ssize_t i, PyObject *v)
548548
return -1;
549549
}
550550
if (i >= 0) {
551-
FT_ATOMIC_STORE_SHORT_RELAXED(((short *) items)[i], (unsigned short) x);
551+
FT_ATOMIC_STORE_USHORT_RELAXED(((unsigned short *) items)[i], (unsigned short) x);
552552
}
553553
return 0;
554554
}
@@ -578,7 +578,7 @@ static PyObject *
578578
II_getitem(char *items, Py_ssize_t i)
579579
{
580580
return PyLong_FromUnsignedLong(
581-
(unsigned long) (unsigned int) FT_ATOMIC_LOAD_INT_RELAXED(((int *) items)[i]));
581+
(unsigned long) FT_ATOMIC_LOAD_UINT_RELAXED(((unsigned int *) items)[i]));
582582
}
583583

584584
static int
@@ -610,7 +610,7 @@ II_setitem(char *items, Py_ssize_t i, PyObject *v)
610610
return -1;
611611
}
612612
if (i >= 0) {
613-
FT_ATOMIC_STORE_INT_RELAXED(((int *) items)[i], (unsigned int) x);
613+
FT_ATOMIC_STORE_UINT_RELAXED(((unsigned int *) items)[i], (unsigned int) x);
614614
}
615615

616616
if (do_decref) {
@@ -643,7 +643,7 @@ static PyObject *
643643
LL_getitem(char *items, Py_ssize_t i)
644644
{
645645
return PyLong_FromUnsignedLong(
646-
(unsigned long) FT_ATOMIC_LOAD_LONG_RELAXED(((long *) items)[i]));
646+
FT_ATOMIC_LOAD_ULONG_RELAXED(((unsigned long *) items)[i]));
647647
}
648648

649649
static int
@@ -667,7 +667,7 @@ LL_setitem(char *items, Py_ssize_t i, PyObject *v)
667667
return -1;
668668
}
669669
if (i >= 0) {
670-
FT_ATOMIC_STORE_LONG_RELAXED(((long *) items)[i], x);
670+
FT_ATOMIC_STORE_ULONG_RELAXED(((unsigned long *) items)[i], x);
671671
}
672672

673673
if (do_decref) {
@@ -700,7 +700,7 @@ static PyObject *
700700
QQ_getitem(char *items, Py_ssize_t i)
701701
{
702702
return PyLong_FromUnsignedLongLong(
703-
(unsigned long long) FT_ATOMIC_LOAD_LLONG_RELAXED(((long long *) items)[i]));
703+
FT_ATOMIC_LOAD_ULLONG_RELAXED(((unsigned long long *) items)[i]));
704704
}
705705

706706
static int
@@ -724,7 +724,7 @@ QQ_setitem(char *items, Py_ssize_t i, PyObject *v)
724724
return -1;
725725
}
726726
if (i >= 0) {
727-
FT_ATOMIC_STORE_LLONG_RELAXED(((long long *) items)[i], x);
727+
FT_ATOMIC_STORE_ULLONG_RELAXED(((unsigned long long *) items)[i], x);
728728
}
729729

730730
if (do_decref) {

0 commit comments

Comments
 (0)