Skip to content

Thread ID assertion in pystate.c failing under WASI #110455

Closed
@brettcannon

Description

@brettcannon

Bug report

Bug description:

The following assert fails under a debug build with WASI:

assert(tstate->thread_id > 0);

It's probably due to the pthread stubs always returning 0 as the thread ID:

PyAPI_FUNC(pthread_t) pthread_self(void)
{
return 0;
}

It can probably be solved by making the assertion conditional on `HAVE_PTHREAD_STUBS not being defined:

#if !defined(HAVE_PTHREAD_STUBS)

CPython versions tested on:

CPython main branch

Operating systems tested on:

Other

Linked PRs

Metadata

Metadata

Assignees

Labels

3.12only security fixes3.13bugs and security fixesOS-wasiinterpreter-core(Objects, Python, Grammar, and Parser dirs)type-bugAn unexpected behavior, bug, or error

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions