X Tutup
Skip to content

Commit 7801ef4

Browse files
committed
ListToTuple
1 parent c497061 commit 7801ef4

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

compiler/core/src/bytecode.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -392,8 +392,15 @@ op_arg_enum!(
392392
#[derive(Copy, Clone, Debug, PartialEq, Eq)]
393393
#[repr(u8)]
394394
pub enum IntrinsicFunction1 {
395+
// Invalid = 0,
396+
// Print = 1,
395397
/// Import * operation
396398
ImportStar = 2,
399+
// StopIterationError = 3,
400+
// AsyncGenWrap = 4,
401+
// UnaryPositive = 5,
402+
/// Convert list to tuple
403+
ListToTuple = 6,
397404
/// Type parameter related
398405
TypeVar = 7,
399406
ParamSpec = 8,

vm/src/frame.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2262,6 +2262,13 @@ impl ExecutingFrame<'_> {
22622262
let type_alias = typing::TypeAliasType::new(name, type_params, value);
22632263
Ok(type_alias.into_ref(&vm.ctx).into())
22642264
}
2265+
bytecode::IntrinsicFunction1::ListToTuple => {
2266+
// Convert list to tuple
2267+
let list = arg
2268+
.downcast::<PyList>()
2269+
.map_err(|_| vm.new_type_error("LIST_TO_TUPLE expects a list"))?;
2270+
Ok(vm.ctx.new_tuple(list.borrow_vec_mut().clone()).into())
2271+
}
22652272
}
22662273
}
22672274

0 commit comments

Comments
 (0)
X Tutup