vm.class() only for non-static types

This commit is contained in:
Jeong YunWon committed 2020-10-20 02:29:31 +09:00
1 parent ecf1120bee
commit 3b78c6068b
2 files changed
+5 -4

No files matched your search

+2 -2
View File
@@ -636,7 +636,7 @@ mod _os {
#[pyimpl(with(PyStructSequence))]
impl StatResult {
pub(super) fn into_obj(self, vm: &VirtualMachine) -> PyObjectRef {
self.into_struct_sequence(vm, vm.class(super::MODULE_NAME, "stat_result"))
self.into_struct_sequence(vm, StatResult::static_type().clone())
.unwrap()
.into_object()
}
@@ -1745,7 +1745,7 @@ mod posix {
#[pyimpl(with(PyStructSequence))]
impl UnameResult {
fn into_obj(self, vm: &VirtualMachine) -> PyObjectRef {
self.into_struct_sequence(vm, vm.class(super::MODULE_NAME, "uname_result"))
self.into_struct_sequence(vm, UnameResult::static_type().clone())
.unwrap()
.into_object()
}
+3 -2
View File
@@ -12,7 +12,8 @@ use crate::builtins::pytype::PyTypeRef;
use crate::builtins::tuple::PyTupleRef;
use crate::function::OptionalArg;
use crate::pyobject::{
BorrowValue, Either, PyClassImpl, PyObjectRef, PyResult, PyStructSequence, TryFromObject,
BorrowValue, Either, PyClassImpl, PyObjectRef, PyResult, PyStructSequence, StaticType,
TryFromObject,
};
use crate::vm::VirtualMachine;
@@ -218,7 +219,7 @@ impl PyStructTime {
}
fn into_obj(self, vm: &VirtualMachine) -> PyObjectRef {
self.into_struct_sequence(vm, vm.class("time", "struct_time"))
self.into_struct_sequence(vm, PyStructTime::static_type().clone())
.unwrap()
.into_object()
}