Skip to content

Commit 609d99f

Browse files
authored
implement sys.implementation cache_tag (RustPython#6255)
1 parent db1adaa commit 609d99f

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

vm/src/stdlib/sys.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -229,11 +229,13 @@ mod sys {
229229

230230
#[pyattr]
231231
fn implementation(vm: &VirtualMachine) -> PyRef<PyNamespace> {
232-
// TODO: Add crate version to this namespace
232+
const NAME: &str = "rustpython";
233+
234+
let cache_tag = format!("{NAME}-{}{}", version::MAJOR, version::MINOR);
233235
let ctx = &vm.ctx;
234236
py_namespace!(vm, {
235-
"name" => ctx.new_str(ascii!("rustpython")),
236-
"cache_tag" => ctx.new_str(ascii!("rustpython-01")),
237+
"name" => ctx.new_str(NAME),
238+
"cache_tag" => ctx.new_str(cache_tag),
237239
"_multiarch" => ctx.new_str(MULTIARCH.to_owned()),
238240
"version" => version_info(vm),
239241
"hexversion" => ctx.new_int(version::VERSION_HEX),

0 commit comments

Comments
 (0)