Skip to content

Commit a1e3fe4

Browse files
Merge pull request RustPython#1538 from palaviv/platform-new-arg-style
Convert platform to new arg style
2 parents 6f59609 + f0e30f2 commit a1e3fe4

File tree

1 file changed

+13
-24
lines changed

1 file changed

+13
-24
lines changed

vm/src/stdlib/platform.rs

Lines changed: 13 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
use crate::function::PyFuncArgs;
2-
use crate::pyobject::{PyObjectRef, PyResult};
1+
use crate::pyobject::PyObjectRef;
32
use crate::version;
43
use crate::vm::VirtualMachine;
54

@@ -15,36 +14,26 @@ pub fn make_module(vm: &VirtualMachine) -> PyObjectRef {
1514
})
1615
}
1716

18-
fn platform_python_implementation(vm: &VirtualMachine, args: PyFuncArgs) -> PyResult {
19-
arg_check!(vm, args);
20-
Ok(vm.new_str("RustPython".to_string()))
17+
fn platform_python_implementation(_vm: &VirtualMachine) -> String {
18+
"RustPython".to_string()
2119
}
2220

23-
fn platform_python_version(vm: &VirtualMachine, args: PyFuncArgs) -> PyResult {
24-
arg_check!(vm, args);
25-
Ok(vm.new_str(version::get_version_number()))
21+
fn platform_python_version(_vm: &VirtualMachine) -> String {
22+
version::get_version_number()
2623
}
2724

28-
fn platform_python_compiler(vm: &VirtualMachine, args: PyFuncArgs) -> PyResult {
29-
arg_check!(vm, args);
30-
Ok(vm.new_str(version::get_compiler()))
25+
fn platform_python_compiler(_vm: &VirtualMachine) -> String {
26+
version::get_compiler()
3127
}
3228

33-
fn platform_python_build(vm: &VirtualMachine, args: PyFuncArgs) -> PyResult {
34-
arg_check!(vm, args);
35-
let git_hash = version::get_git_identifier();
36-
let git_timestamp = version::get_git_datetime();
37-
Ok(vm
38-
.ctx
39-
.new_tuple(vec![vm.new_str(git_hash), vm.new_str(git_timestamp)]))
29+
fn platform_python_build(_vm: &VirtualMachine) -> (String, String) {
30+
(version::get_git_identifier(), version::get_git_datetime())
4031
}
4132

42-
fn platform_python_branch(vm: &VirtualMachine, args: PyFuncArgs) -> PyResult {
43-
arg_check!(vm, args);
44-
Ok(vm.new_str(version::get_git_branch()))
33+
fn platform_python_branch(_vm: &VirtualMachine) -> String {
34+
version::get_git_branch()
4535
}
4636

47-
fn platform_python_revision(vm: &VirtualMachine, args: PyFuncArgs) -> PyResult {
48-
arg_check!(vm, args);
49-
Ok(vm.new_str(version::get_git_revision()))
37+
fn platform_python_revision(_vm: &VirtualMachine) -> String {
38+
version::get_git_revision()
5039
}

0 commit comments

Comments
 (0)