Skip to content

Commit da293c1

Browse files
committed
Fix the test.
1 parent 8c4c49a commit da293c1

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

Lib/test/test_ctypes/test_arrays.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
create_string_buffer, create_unicode_buffer,
66
c_char, c_wchar, c_byte, c_ubyte, c_short, c_ushort, c_int, c_uint,
77
c_long, c_ulonglong, c_float, c_double, c_longdouble)
8-
from test.support import bigmemtest, _2G, threading_helper
8+
from test.support import bigmemtest, _2G, threading_helper, Py_GIL_DISABLED
99
from ._support import (_CData, PyCArrayType, Py_TPFLAGS_DISALLOW_INSTANTIATION,
1010
Py_TPFLAGS_IMMUTABLETYPE)
1111

@@ -268,7 +268,7 @@ def test_large_array(self, size):
268268
c_char * size
269269

270270
@threading_helper.requires_working_threading()
271-
@unittest.skipUnless(support.Py_GIL_DISABLED, "only meaningful if the GIL is disabled")
271+
@unittest.skipUnless(Py_GIL_DISABLED, "only meaningful if the GIL is disabled")
272272
def test_thread_safety(self):
273273
from threading import Thread
274274

@@ -280,7 +280,7 @@ def run():
280280
buffer[0] = b"j"
281281

282282
with threading_helper.catch_threading_exception() as cm:
283-
with threading_helper.start_threads((run for _ in range(25))):
283+
with threading_helper.start_threads((Thread(target=run) for _ in range(25))):
284284
pass
285285

286286
self.assertIsNone(cm.exc_value)

Modules/_ctypes/ctypes.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -587,6 +587,6 @@ static inline void
587587
locked_deref_assign(CDataObject *self, void *new_ptr)
588588
{
589589
LOCK_PTR(self);
590-
*self->b_ptr = new_ptr;
590+
*(void **)self->b_ptr = new_ptr;
591591
UNLOCK_PTR(self);
592592
}

0 commit comments

Comments
 (0)