Isolate RustPython bytecode caches during the 3.15 transition

Assisted-by: OpenAI Codex:model identifier unavailable
This commit is contained in:
youknowdot committed 2026-10-10 10:12:59 +09:00
1 parent 90d2d12074
commit 1af8926c71
3 files changed
+6 -4

No files matched your search

+2 -2
View File
@@ -667,8 +667,8 @@ pub mod sys {
fn implementation(vm: &VirtualMachine) -> PyRef<PyNamespace> {
const NAME: &str = "rustpython";
// cache tag uses 'cpython' because our compiler is cpython compatible
let cache_tag = format!("cpython-{}{}", version::MAJOR, version::MINOR);
// Keep implementation-specific bytecode caches separate.
let cache_tag = format!("{NAME}-{}{}", version::MAJOR, version::MINOR);
let ctx = &vm.ctx;
py_namespace!(vm, {
"name" => ctx.new_str(NAME),
+1 -1
View File
@@ -1607,7 +1607,7 @@ impl VirtualMachine {
/// ```no_run
/// use rustpython_vm::Interpreter;
/// Interpreter::without_stdlib(Default::default()).enter(|vm| {
/// let bytes = std::fs::read("__pycache__/<input>.cpython-315.pyc").unwrap();
/// let bytes = std::fs::read("__pycache__/<input>.rustpython-315.pyc").unwrap();
/// let main_scope = vm.new_scope_with_main().unwrap();
/// vm.run_pyc_bytes(&bytes, main_scope);
/// });
+3 -1
View File
@@ -28,7 +28,9 @@ assert isinstance(sys.implementation.cache_tag, str)
assert sys.version_info[:3] == (3, 15, 0)
assert sys.hexversion >> 8 == 0x030F00
assert sys.version.startswith("3.15.0")
assert sys.implementation.cache_tag == "cpython-315"
assert sys.implementation.cache_tag == (
f"{sys.implementation.name}-{sys.version_info.major}{sys.version_info.minor}"
)
assert sys.getfilesystemencoding() == "utf-8"
assert sys.getfilesystemencodeerrors().startswith("surrogate")