mirror of
https://github.com/pocketpy/pocketpy
synced 2026-08-06 22:27:11 +08:00
Adds an optional open_file callback to py_Callbacks, consulted before script-reachable file operations: - io.FileIO(path, mode): called with the fopen mode string before the open - os.remove(path): called with the literal "delete" Returning false rejects the operation and raises OSError; returning true (or leaving the callback NULL, which is the default) allows it. Existing embedders are unaffected -- the default is NULL and behavior is unchanged. This lets an embedder enforce its own path policy using its own canonicalization instead of reimplementing path checks inside the VM.