Skip to content

CPython should not assume that pthread_self returns the same value in fork parent and child #126688

Closed
@nico

Description

@nico

Summarized from SerenityOS/serenity#25263 by request of @colesbury:

It seems that at least Python 3.13 relies on pthread_self returning the same value in both the parent and the child process.
PyThread_get_thread_ident_ex

POSIX doesn't seem to mention if the value returned by pthread_self should be inherited by the child process.
pthread_self
fork

(It is the case on Linux, Hurd, FreeBSD, OpenBSD, Cygwin. It isn't on SerenityOS, and also not on Solaris 9/HP-UX 11 per https://bugs.python.org/issue7242.

It looks like the code add broke things is from this commit e21057b added in #118523 as part of #117657

Linked PRs

Metadata

Metadata

Assignees

Labels

3.13bugs and security fixes3.14new features, bugs and security fixestype-bugAn unexpected behavior, bug, or error

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions