Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 1 addition & 5 deletions Lib/test/support/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -1373,11 +1373,7 @@ def internal(*args, **kwargs):
import_module('_testcapi')
return test(*args, **kwargs)

use_tsan = check_sanitizer(thread=True)
reason ='not working with thread sanitizer (gh-157415)'
skip_if_tsan = unittest.skipIf(use_tsan, reason)

return cpython_only(skip_if_tsan(internal))
return cpython_only(internal)

def bigaddrspacetest(f):
"""Decorator for tests that fill the address space."""
Expand Down
8 changes: 5 additions & 3 deletions Python/thread_pthread.h
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ pythread_wrapper(void *arg)
pythread_callback *callback = arg;
void (*func)(void *) = callback->func;
void *func_arg = callback->arg;
PyMem_RawFree(arg);
free(callback);

func(func_arg);
return NULL;
Expand Down Expand Up @@ -271,7 +271,9 @@ do_start_joinable_thread(void (*func)(void *), void *arg, pthread_t* out_id)
pthread_attr_setscope(&attrs, PTHREAD_SCOPE_SYSTEM);
#endif

pythread_callback *callback = PyMem_RawMalloc(sizeof(pythread_callback));
// Use free() instead of PyMem_RawFree() in pythread_wrapper() to avoid a
// data race if another thread calls PyMem_SetAllocator() in parallel.
pythread_callback *callback = malloc(sizeof(pythread_callback));

if (callback == NULL) {
return -1;
Expand All @@ -293,7 +295,7 @@ do_start_joinable_thread(void (*func)(void *), void *arg, pthread_t* out_id)
#endif

if (status != 0) {
PyMem_RawFree(callback);
free(callback);
return -1;
}
*out_id = th;
Expand Down
Loading