Skip to content

Commit 9f3a26e

Browse files
committed
Replace new_tuple(vec![]) with empty_tuple()
1 parent daace14 commit 9f3a26e

File tree

6 files changed

+7
-7
lines changed

6 files changed

+7
-7
lines changed

src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,7 @@ fn run_command(vm: &VirtualMachine, source: String) -> PyResult<()> {
318318

319319
fn run_module(vm: &VirtualMachine, module: &str) -> PyResult<()> {
320320
debug!("Running module {}", module);
321-
vm.import(module, &vm.ctx.new_tuple(vec![]), 0)?;
321+
vm.import(module, &vm.ctx.empty_tuple, 0)?;
322322
Ok(())
323323
}
324324

vm/src/frame.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -725,7 +725,7 @@ impl Frame {
725725
level: usize,
726726
) -> FrameResult {
727727
let module = module.clone().unwrap_or_default();
728-
let module = vm.import(&module, &vm.ctx.new_tuple(vec![]), level)?;
728+
let module = vm.import(&module, &vm.ctx.empty_tuple, level)?;
729729

730730
// Grab all the names from the module and put them in the context
731731
if let Some(dict) = &module.dict {

vm/src/import.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ pub fn init_importlib(vm: &VirtualMachine, external: bool) -> PyResult {
2727
vm.invoke(install_external, vec![])?;
2828
// Set pyc magic number to commit hash. Should be changed when bytecode will be more stable.
2929
let importlib_external =
30-
vm.import("_frozen_importlib_external", &vm.ctx.new_tuple(vec![]), 0)?;
30+
vm.import("_frozen_importlib_external", &vm.ctx.empty_tuple, 0)?;
3131
let mut magic = get_git_revision().into_bytes();
3232
magic.truncate(4);
3333
if magic.len() != 4 {

vm/src/stdlib/ast.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ macro_rules! node {
4242
( $vm: expr, $node_name:ident) => {
4343
{
4444
let node = create_node($vm, stringify!($node_name))?;
45-
$vm.set_attr(node.as_object(), "_fields", $vm.ctx.new_tuple(vec![]))?;
45+
$vm.set_attr(node.as_object(), "_fields", $vm.ctx.empty_tuple())?;
4646
node
4747
}
4848
}

vm/src/stdlib/io.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -601,7 +601,7 @@ pub fn io_open(vm: &VirtualMachine, args: PyFuncArgs) -> PyResult {
601601
}
602602
};
603603

604-
let io_module = vm.import("_io", &vm.ctx.new_tuple(vec![]), 0)?;
604+
let io_module = vm.import("_io", &vm.ctx.empty_tuple, 0)?;
605605

606606
// Construct a FileIO (subclass of RawIOBase)
607607
// This is subsequently consumed by a Buffered Class.

vm/src/vm.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -217,15 +217,15 @@ impl VirtualMachine {
217217

218218
pub fn try_class(&self, module: &str, class: &str) -> PyResult<PyClassRef> {
219219
let class = self
220-
.get_attribute(self.import(module, &self.ctx.new_tuple(vec![]), 0)?, class)?
220+
.get_attribute(self.import(module, &self.ctx.empty_tuple, 0)?, class)?
221221
.downcast()
222222
.expect("not a class");
223223
Ok(class)
224224
}
225225

226226
pub fn class(&self, module: &str, class: &str) -> PyClassRef {
227227
let module = self
228-
.import(module, &self.ctx.new_tuple(vec![]), 0)
228+
.import(module, &self.ctx.empty_tuple, 0)
229229
.unwrap_or_else(|_| panic!("unable to import {}", module));
230230
let class = self
231231
.get_attribute(module.clone(), class)

0 commit comments

Comments
 (0)