From: Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> Date: Fri, 6 Oct 2023 23:48:48 +0000 (-0700) Subject: [3.12] GH-110455: Guard `assert(tstate->thread_id > 0)` with `GH-ifndef HAVE_PTHREAD_... X-Git-Tag: v3.12.1~357 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=2465fe00140fd902e7b5b61e12db4a6f7107e2fa;p=thirdparty%2FPython%2Fcpython.git [3.12] GH-110455: Guard `assert(tstate->thread_id > 0)` with `GH-ifndef HAVE_PTHREAD_STUBS` (GH-110487) (GH-110491) GH-110455: Guard `assert(tstate->thread_id > 0)` with `GH-ifndef HAVE_PTHREAD_STUBS` (GH-110487) (cherry picked from commit 5fd8821cf8eb1fe2e8575f8c7cc747cf78855a88) Co-authored-by: Brett Cannon --- 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 000000000000..47bf17da757d --- /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 b77827ff8efa..6f60c3dccce2 100644 --- a/Python/pystate.c +++ b/Python/pystate.c @@ -264,10 +264,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