mirror of
https://github.com/RustPython/RustPython.git
synced 2026-10-28 18:59:04 +08:00
Fix test_long::test_huge_rshift
This commit is contained in:
1 parent
4a6df6bb20
commit
8f0e40f2b2
2 files changed
+1
-5
No files matched your search
Vendored
-2
@@ -953,8 +953,6 @@ class LongTest(unittest.TestCase):
|
||||
def test_huge_lshift(self, size):
|
||||
self.assertEqual(1 << (sys.maxsize + 1000), 1 << 1000 << sys.maxsize)
|
||||
|
||||
# TODO: RUSTPYTHON
|
||||
@unittest.expectedFailure
|
||||
def test_huge_rshift(self):
|
||||
self.assertEqual(42 >> (1 << 1000), 0)
|
||||
self.assertEqual((-42) >> (1 << 1000), -1)
|
||||
|
||||
@@ -166,9 +166,7 @@ where
|
||||
} else if int1.is_zero() {
|
||||
Ok(vm.ctx.new_int(0).into())
|
||||
} else {
|
||||
let int2 = int2.to_usize().ok_or_else(|| {
|
||||
vm.new_overflow_error("the number is too large to convert to int".to_owned())
|
||||
})?;
|
||||
let int2 = int2.min(&BigInt::from(usize::MAX)).to_usize().unwrap();
|
||||
Ok(vm.ctx.new_int(shift_op(int1, int2)).into())
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user