]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
GH-110455: Guard `assert(tstate->thread_id > 0)` with `#ifndef HAVE_PTHREAD_STUBS...
authorBrett Cannon <brett@python.org>
Fri, 6 Oct 2023 23:12:19 +0000 (16:12 -0700)
committerGitHub <noreply@github.com>
Fri, 6 Oct 2023 23:12:19 +0000 (16:12 -0700)
Misc/NEWS.d/next/Core and Builtins/2023-10-06-12-00-43.gh-issue-110455.8BjNGg.rst [new file with mode: 0644]
Python/pystate.c

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 (file)
index 0000000..47bf17d
--- /dev/null
@@ -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.
index a024ae7e3806a65e0a5031c4296ef5d29ee0e749..849a4eec86af833145f4d92c03bd794181f1f613 100644 (file)
@@ -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