mirror of
https://github.com/RustPython/RustPython.git
synced 2026-10-28 18:59:04 +08:00
remove duplicated type check
This commit is contained in:
1 parent
283c97cda7
commit
580bcb526f
1 file changed
+5
-12
+5
-12
@@ -530,20 +530,13 @@ impl PyInt {
|
||||
match precision {
|
||||
OptionalArg::Missing => (),
|
||||
OptionalArg::Present(ref value) => {
|
||||
if !vm.is_none(value) {
|
||||
// Only accept int type ndigits
|
||||
let _ndigits = value.payload_if_subclass::<PyInt>(vm).ok_or_else(|| {
|
||||
vm.new_type_error(format!(
|
||||
"'{}' object cannot be interpreted as an integer",
|
||||
value.class().name()
|
||||
))
|
||||
})?;
|
||||
} else {
|
||||
return Err(vm.new_type_error(format!(
|
||||
// Only accept int type ndigits
|
||||
let _ndigits = value.payload_if_subclass::<PyInt>(vm).ok_or_else(|| {
|
||||
vm.new_type_error(format!(
|
||||
"'{}' object cannot be interpreted as an integer",
|
||||
value.class().name()
|
||||
)));
|
||||
}
|
||||
))
|
||||
})?;
|
||||
}
|
||||
}
|
||||
Ok(zelf)
|
||||
|
||||
Reference in new issue
Block a user