GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Emscripten build fails when WebAssembly reference types are disabled · Issue #161782 · python/cpython

Emscripten build fails when WebAssembly reference types are disabled #161782

New issue
Copy link
New issue
Copy link
Open
#161783
Open
Emscripten build fails when WebAssembly reference types are disabled#161782
#161783
Copy link
Labels
OS-emscriptentype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error

Description

@garbear
garbear
opened on Nov 10, 2026
Issue body actions

Bug report

CPython's Emscripten syscall overrides fail to compile when WebAssembly reference types are disabled with -mno-reference-types.

Python/emscripten_syscalls.c unconditionally uses __externref_t and reference-type builtins in its optional JavaScript Promise Integration (JSPI) read and poll wrappers. These types are unavailable when reference types are disabled, even if JSPI is never used.

Steps to reproduce

  1. Build CPython for wasm32-emscripten using Emscripten 7.0.0.
  2. Compile with -mno-reference-types.
  3. Build Python/emscripten_syscalls.c.

Actual result

Compilation fails with errors involving __externref_t (nine errors in the tested configuration).

Modules containing externref also cannot instantiate in older browsers such as Chromium 85.

Expected result

CPython should compile without WebAssembly reference types, retaining synchronous read and poll syscall implementations when JSPI is unavailable.

Suggested fix

Conditionally compile the reference-type-dependent JSPI wrappers using __wasm_reference_types__, and provide a no-op interpreter startup hook when reference types are disabled.

Validation

Tested against CPython main (226813c0f7834b55be51e912a3d8555e652d9026) using Emscripten 7.0.0 and Node.js 26.

With the proposed fix:

  • Both reference-type configurations compile successfully.
  • Eight focused runtime tests pass, covering startup, synchronous syscall fallbacks, JSPI read/poll, and error handling.
  • The disabled configuration contains no externref instructions.
  • The enabled object is byte-for-byte identical to the original implementation.

A full CPython build and test suite were not run.

Originally discovered while bringing up Kodi on a Samsung Q60B running Chromium 85.

Related downstream fix: xbmc/xbmc#30431

AI disclosure: GPT-6 Astra, Extra high

CPython versions tested on:

CPython main branch, 3.14

Operating systems tested on:

macOS

Linked PRs

  • gh-161782: Emscripten: support builds without reference types #161783

Activity

  1. garbear
    added
    type-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
    on Nov 10, 2026
  2. garbear
    added 2 commits that reference this issue on Nov 10, 2026

    pythongh-161782: Emscripten: support builds without reference types

    a9c7a9c

    pythongh-161782: Emscripten: support builds without reference types

    f0d5e4f
  3. aisk
    added
    OS-emscripten
    on Nov 11, 2026
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-emscriptentype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402503 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.