forked from Rust-related/RustPython
Merge pull request #2184 from edwardycl/pyvalue
.into_ref(vm).into_object() -> .into_object(vm)
This commit is contained in:
@@ -705,7 +705,7 @@ mod decl {
|
||||
let len = vm.call_method(&obj, "__len__", PyFuncArgs::default())?;
|
||||
let len = objint::get_value(&len).to_isize().unwrap();
|
||||
let obj_iterator = objiter::PySequenceIterator::new_reversed(obj, len);
|
||||
Ok(obj_iterator.into_ref(vm).into_object())
|
||||
Ok(obj_iterator.into_object(vm))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -453,7 +453,7 @@ impl ExecutingFrame<'_> {
|
||||
bytecode::Instruction::YieldValue => {
|
||||
let value = self.pop_value();
|
||||
let value = if self.code.flags.contains(bytecode::CodeFlags::IS_COROUTINE) {
|
||||
PyAsyncGenWrappedValue(value).into_ref(vm).into_object()
|
||||
PyAsyncGenWrappedValue(value).into_object(vm)
|
||||
} else {
|
||||
value
|
||||
};
|
||||
|
||||
@@ -341,13 +341,13 @@ impl PyClassRef {
|
||||
let mut attributes = dict.to_attributes();
|
||||
if let Some(f) = attributes.get_mut("__new__") {
|
||||
if f.class().is(&vm.ctx.types.function_type) {
|
||||
*f = PyStaticMethod::from(f.clone()).into_ref(vm).into_object();
|
||||
*f = PyStaticMethod::from(f.clone()).into_object(vm);
|
||||
}
|
||||
}
|
||||
|
||||
if let Some(f) = attributes.get_mut("__init_subclass__") {
|
||||
if f.class().is(&vm.ctx.types.function_type) {
|
||||
*f = PyClassMethod::from(f.clone()).into_ref(vm).into_object();
|
||||
*f = PyClassMethod::from(f.clone()).into_object(vm);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -69,7 +69,7 @@ pub fn build_reader(
|
||||
) -> PyResult {
|
||||
let config = ReaderOption::new(args, vm)?;
|
||||
|
||||
Ok(Reader::new(iterable, config).into_ref(vm).into_pyobject(vm))
|
||||
Ok(Reader::new(iterable, config).into_object(vm))
|
||||
}
|
||||
|
||||
fn into_strings(iterable: &PyIterable<PyObjectRef>, vm: &VirtualMachine) -> PyResult<Vec<String>> {
|
||||
|
||||
@@ -1115,7 +1115,7 @@ mod decl {
|
||||
|
||||
self.update_idxs(idxs);
|
||||
|
||||
Ok(res.into_ref(vm).into_object())
|
||||
Ok(res.into_object(vm))
|
||||
}
|
||||
|
||||
fn update_idxs(&self, mut idxs: PyRwLockWriteGuard<'_, Vec<usize>>) {
|
||||
@@ -1243,7 +1243,7 @@ mod decl {
|
||||
}
|
||||
}
|
||||
|
||||
Ok(res.into_ref(vm).into_object())
|
||||
Ok(res.into_object(vm))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -291,7 +291,7 @@ fn create_match(vm: &VirtualMachine, haystack: PyStringRef, captures: Captures)
|
||||
.iter()
|
||||
.map(|opt| opt.map(|m| m.start()..m.end()))
|
||||
.collect();
|
||||
PyMatch { haystack, captures }.into_ref(vm).into_object()
|
||||
PyMatch { haystack, captures }.into_object(vm)
|
||||
}
|
||||
|
||||
fn extract_flags(flags: OptionalArg<usize>) -> PyRegexFlags {
|
||||
|
||||
@@ -171,7 +171,7 @@ mod decl {
|
||||
.symtable
|
||||
.sub_tables
|
||||
.iter()
|
||||
.map(|t| to_py_symbol_table(t.clone()).into_ref(vm).into_object())
|
||||
.map(|t| to_py_symbol_table(t.clone()).into_object(vm))
|
||||
.collect();
|
||||
Ok(vm.ctx.new_list(children))
|
||||
}
|
||||
@@ -267,7 +267,7 @@ mod decl {
|
||||
let namespaces = self
|
||||
.namespaces
|
||||
.iter()
|
||||
.map(|table| to_py_symbol_table(table.clone()).into_ref(vm).into_object())
|
||||
.map(|table| to_py_symbol_table(table.clone()).into_object(vm))
|
||||
.collect();
|
||||
Ok(vm.ctx.new_list(namespaces))
|
||||
}
|
||||
|
||||
@@ -109,7 +109,7 @@ fn browser_fetch(url: PyStringRef, args: FetchArgs, vm: &VirtualMachine) -> PyRe
|
||||
JsFuture::from(response_format.get_response(&response)?).await
|
||||
};
|
||||
|
||||
Ok(PyPromise::from_future(future).into_ref(vm).into_object())
|
||||
Ok(PyPromise::from_future(future).into_object(vm))
|
||||
}
|
||||
|
||||
fn browser_request_animation_frame(func: PyCallable, vm: &VirtualMachine) -> PyResult {
|
||||
@@ -264,7 +264,7 @@ impl Document {
|
||||
.query_selector(query.borrow_value())
|
||||
.map_err(|err| convert::js_py_typeerror(vm, err))?;
|
||||
let elem = match elem {
|
||||
Some(elem) => Element { elem }.into_ref(vm).into_object(),
|
||||
Some(elem) => Element { elem }.into_object(vm),
|
||||
None => vm.get_none(),
|
||||
};
|
||||
Ok(elem)
|
||||
@@ -336,7 +336,7 @@ fn browser_load_module(module: PyStringRef, path: PyStringRef, vm: &VirtualMachi
|
||||
}
|
||||
};
|
||||
|
||||
Ok(PyPromise::from_future(future).into_ref(vm).into_object())
|
||||
Ok(PyPromise::from_future(future).into_object(vm))
|
||||
}
|
||||
|
||||
pub fn make_module(vm: &VirtualMachine) -> PyObjectRef {
|
||||
|
||||
Reference in New Issue
Block a user