Repository navigation
Let registerPythonCommonModules() take a ModuleSource - #8542
Conversation
PYODIDE_BUNDLE is the one compiled-in bundle that was still registered without the jsg::ModuleSource the other bundles accept, so an embedder with its own storage for module sources could not serve the Python builtins from it. Thread the parameter through to addBuiltinBundle(), defaulting to nullptr as elsewhere. PyodideBundleManager::setPyodideBundleData() takes the bundle as kj::Array<const kj::byte>: the manager only reads it, and the bytes may come from read-only storage.
There was a problem hiding this comment.
✅ Approved — A small change that threads an optional parameter through and keeps existing behaviour, plus a const-correctness fix to a signature. No issues found.
The decision is advisory: this review is a comment and never approves, blocks or requests changes on the pull request.
✅ All checks passed
📋 Code Quality: ✅ LGTM
moduleSource is passed to the matching addBuiltinBundle overload. A null value keeps the previous behaviour, and existing callers are unaffected because the new trailing parameter has a default. Changing setPyodideBundleData to take kj::Array<const kj::byte> is correct: the data is only read, and both callers pass rvalue kj::Array<kj::byte>, which converts implicitly.
📝 Documentation: ✅ LGTM
The new comments in pyodide.h and worker-modules.h accurately describe the lifetime and storage requirements for the bundle data and the module source.
Reviewed commit: 65427a64
PYODIDE_BUNDLE is the one compiled-in bundle that was still registered without the jsg::ModuleSource the other bundles accept, so an embedder with its own storage for module sources could not serve the Python builtins from it. Thread the parameter through to addBuiltinBundle(), defaulting to nullptr as elsewhere.
PyodideBundleManager::setPyodideBundleData() takes the bundle as kj::Array: the manager only reads it, and the bytes may come from read-only storage.