Skip to content

PyodideBridge dispose should reset initPromise to allow re-init #69

@bbopen

Description

@bbopen

Summary

PyodideBridge.dispose() sets this.py to undefined but leaves initPromise intact. Subsequent init() calls return the resolved promise without reinitializing, leaving py undefined and causing failures.

Failure mode

  • Create bridge → init()dispose()init() again.
  • ensureReady() returns the existing initPromise and does not re-run initialization.
  • call/instantiate fail with "Pyodide not initialized".

Evidence

  • src/runtime/pyodide.ts dispose() and ensureReady().

Proposed fix

  • Clear initPromise in dispose().
  • Consider resetting any other state that blocks re-init.

Acceptance criteria

  • After dispose(), a new init() reinitializes pyodide successfully.
  • Add a test covering dispose → re-init flow.

Metadata

Metadata

Assignees

Labels

area:runtime-pyodideArea: Pyodide runtime bridgebugSomething isn't workingpriority:p3Priority P3 (low)

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions