Skip to content

Commit

Permalink
Always invalidate_caches when loading snapshots
Browse files Browse the repository at this point in the history
Originally we had baseline snapshots shared and dedicated snapshots per worker.
But now we also have shared package snapshots. To be safe let's just always call
it.
  • Loading branch information
hoodmane committed Sep 10, 2024
1 parent 8324a66 commit 884486d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
5 changes: 2 additions & 3 deletions src/pyodide/internal/snapshot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -437,9 +437,8 @@ let TEST_SNAPSHOT: Uint8Array | undefined = undefined;
})();

export function finishSnapshotSetup(pyodide: Pyodide): void {
if (DSO_METADATA?.settings?.baselineSnapshot) {
// Invalidate caches if we have a baseline snapshot because the contents of site-packages may
// have changed.
if (LOADED_SNAPSHOT_VERSION !== undefined) {
// Invalidate caches if we have a snapshot because the contents of site-packages may have changed.
simpleRunPython(
pyodide._module,
'from importlib import invalidate_caches as f; f(); del f'
Expand Down
3 changes: 2 additions & 1 deletion src/pyodide/internal/topLevelEntropy/lib.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ import { simpleRunPython } from 'pyodide-internal:util';
// created without entropy gating and will crash if they are used with it. If we are creating a new
// snapshot or using one of version at least 2 we should gate.
// TODO: When we've updated all the snapshots, remove this.
const SHOULD_GATE_ENTROPY = LOADED_SNAPSHOT_VERSION !== 0 && LOADED_SNAPSHOT_VERSION !== 1;
const SHOULD_GATE_ENTROPY =
LOADED_SNAPSHOT_VERSION !== 0 && LOADED_SNAPSHOT_VERSION !== 1;

let allowed_entropy_calls_addr: number;

Expand Down

0 comments on commit 884486d

Please sign in to comment.