Skip to content

Emscripten: Remove obsolete pthread_getattr_np workaround in ceval.c #160873

Open

Description

@lpyu001

Bug report

Description

The workaround in Python/ceval.c was introduced to address a broken pthread_getattr_np() implementation in Emscripten versions prior to 4.0.6 (GH-130396, #131088).

The existing comment explicitly describes it as temporary:

#if defined(__EMSCRIPTEN__)

// Temporary workaround to make `pthread_getattr_np` work on Emscripten.
// Emscripten 4.0.6 will contain a fix:
// https://github.com/emscripten-core/emscripten/pull/23887

However, the workaround is still enabled for all Emscripten versions because it only checks __EMSCRIPTEN__, regardless of the toolchain version.

The upstream fix was included in Emscripten 4.0.6, and CPython now uses Emscripten 6.0.13 (Platforms/emscripten/config.toml).

Therefore, this workaround appears to be obsolete and could potentially be removed, allowing CPython to use Emscripten's native pthread_getattr_np() implementation.

The removal should be verified against the current Emscripten toolchain to ensure that stack boundary detection and recursion protection continue to work correctly.

CPython versions tested on:

CPython main branch

Operating systems tested on:

Linux

Linked PRs

Activity

  1. added a commit that references this issue on Oct 29, 2026
  2. lpyu001 commented on Oct 29, 2026

    @lpyu001
    ContributorAuthor

    Two more leftovers from older Emscripten versions:

    1. Deprecated Emscripten flags in configure.ac. --enable-wasm-pthreads links with -sUSE_PTHREADS, and the wasm64-*-emscripten target uses -sMEMORY64=1. Both settings were deprecated in Emscripten 6.0.1 in favor of -pthread and -m64 (Deprecate -sUSE_PTHREADS and -sMEMORY64 in favor of standard flags. emscripten-core/emscripten#27025), and with 6.0.10 they emit -Wdeprecated warnings at link time. The replacements produce identical output. The default build doesn't use either option, so CI doesn't show the warnings.

    2. Obsolete Emscripten workaround in test_pathlib. test_glob_dotdot uses NDOTDOTS = 48 on Emscripten instead of 50, with a comment saying it can be removed once JS FS: Don't return ELOOP on a path with a large number of ..'s emscripten-core/emscripten#24591 is merged. That fix was merged in June 2025 (Emscripten 4.0.11+), so the workaround is no longer needed with the pinned 6.0.10.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    OS-emscripteninterpreter-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