From 5fd8821cf8eb1fe2e8575f8c7cc747cf78855a88 Mon Sep 17 00:00:00 2001 From: Brett Cannon Date: Fri, 6 Oct 2023 16:12:19 -0700 Subject: GH-110455: Guard `assert(tstate->thread_id > 0)` with `#ifndef HAVE_PTHREAD_STUBS` (GH-110487) --- .../Core and Builtins/2023-10-06-12-00-43.gh-issue-110455.8BjNGg.rst | 3 +++ Python/pystate.c | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) create mode 100644 Misc/NEWS.d/next/Core and Builtins/2023-10-06-12-00-43.gh-issue-110455.8BjNGg.rst diff --git a/Misc/NEWS.d/next/Core and Builtins/2023-10-06-12-00-43.gh-issue-110455.8BjNGg.rst b/Misc/NEWS.d/next/Core and Builtins/2023-10-06-12-00-43.gh-issue-110455.8BjNGg.rst new file mode 100644 index 0000000..47bf17d --- /dev/null +++ b/Misc/NEWS.d/next/Core and Builtins/2023-10-06-12-00-43.gh-issue-110455.8BjNGg.rst @@ -0,0 +1,3 @@ +Guard ``assert(tstate->thread_id > 0)`` with ``#ifndef HAVE_PTHREAD_STUBS``. +This allows for for pydebug builds to work under WASI which (currently) +lacks thread support. diff --git a/Python/pystate.c b/Python/pystate.c index a024ae7..849a4ee 100644 --- a/Python/pystate.c +++ b/Python/pystate.c @@ -263,10 +263,10 @@ static void unbind_tstate(PyThreadState *tstate) { assert(tstate != NULL); - // XXX assert(tstate_is_alive(tstate)); assert(tstate_is_bound(tstate)); - // XXX assert(!tstate->_status.active); +#ifndef HAVE_PTHREAD_STUBS assert(tstate->thread_id > 0); +#endif #ifdef PY_HAVE_THREAD_NATIVE_ID assert(tstate->native_thread_id > 0); #endif -- cgit v0.12