Skip to content

Commit 580bcb5

Browse files
committed
remove duplicated type check
1 parent 283c97c commit 580bcb5

File tree

1 file changed

+5
-12
lines changed

1 file changed

+5
-12
lines changed

vm/src/builtins/int.rs

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -530,20 +530,13 @@ impl PyInt {
530530
match precision {
531531
OptionalArg::Missing => (),
532532
OptionalArg::Present(ref value) => {
533-
if !vm.is_none(value) {
534-
// Only accept int type ndigits
535-
let _ndigits = value.payload_if_subclass::<PyInt>(vm).ok_or_else(|| {
536-
vm.new_type_error(format!(
537-
"'{}' object cannot be interpreted as an integer",
538-
value.class().name()
539-
))
540-
})?;
541-
} else {
542-
return Err(vm.new_type_error(format!(
533+
// Only accept int type ndigits
534+
let _ndigits = value.payload_if_subclass::<PyInt>(vm).ok_or_else(|| {
535+
vm.new_type_error(format!(
543536
"'{}' object cannot be interpreted as an integer",
544537
value.class().name()
545-
)));
546-
}
538+
))
539+
})?;
547540
}
548541
}
549542
Ok(zelf)

0 commit comments

Comments
 (0)