Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Python baseline snapshot: Invalidate caches #1913

Merged
merged 1 commit into from
Mar 27, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/pyodide/internal/python.js
Original file line number Diff line number Diff line change
Expand Up @@ -553,6 +553,11 @@ export async function loadPyodide(lockfile, indexURL) {
// Finish setting up Pyodide's ffi so we can use the nice Python interface
await enterJaegerSpan("finalize_bootstrap", Module.API.finalizeBootstrap);
const pyodide = Module.API.public_api;
if (DSO_METADATA?.settings?.baselineSnapshot) {
// Invalidate caches if we have a baseline snapshot because the contents of site-packages may
// have changed.
simpleRunPython(Module, "from importlib import invalidate_caches as f; f(); del f");
}

// This is just here for our test suite. Ugly but just about the only way to test this.
if (TEST_SNAPSHOT) {
Expand Down
Loading