mirror of
https://github.com/RustPython/RustPython.git
synced 2026-10-28 10:44:36 +08:00
Use typed constant index conversion in script validation
Assisted-by: OpenAI Codex:model identifier unavailable
This commit is contained in:
1 parent
1f1fe045bb
commit
a2dacaf4bd
1 file changed
+1
-1
@@ -843,7 +843,7 @@ pub(crate) fn code_returns_only_none(code: &Py<PyCode>) -> bool {
|
|||||||
Instruction::LoadCommonConstant { idx } => idx.get(arg) == CommonConstant::None,
|
Instruction::LoadCommonConstant { idx } => idx.get(arg) == CommonConstant::None,
|
||||||
Instruction::LoadConst { consti } => code
|
Instruction::LoadConst { consti } => code
|
||||||
.constants
|
.constants
|
||||||
.get(consti.get(arg) as usize)
|
.get(usize::from(consti.get(arg)))
|
||||||
.is_some_and(|value| matches!(value.borrow_constant(), BorrowedConstant::None)),
|
.is_some_and(|value| matches!(value.borrow_constant(), BorrowedConstant::None)),
|
||||||
_ => false,
|
_ => false,
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in new issue
Block a user