pFad - Phone/Frame/Anonymizer/Declutterfier! Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

URL: http://github.com/RustPython/RustPython/commit/d1ea35962b039b204035ac51585a84b6a2ec1a07

css" /> Match divmod zero-division message with CPython (#7426) · RustPython/RustPython@d1ea359 · GitHub
Skip to content

Commit d1ea359

Browse files
authored
Match divmod zero-division message with CPython (#7426)
1 parent 40fc7c2 commit d1ea359

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

Lib/test/test_builtin.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -727,7 +727,6 @@ def test___ne__(self):
727727
self.assertIs(None.__ne__(0), NotImplemented)
728728
self.assertIs(None.__ne__("abc"), NotImplemented)
729729

730-
@unittest.expectedFailure # TODO: RUSTPYTHON; wrong error message
731730
def test_divmod(self):
732731
self.assertEqual(divmod(12, 7), (1, 5))
733732
self.assertEqual(divmod(-12, 7), (-2, 2))

crates/vm/src/builtins/float.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -119,11 +119,11 @@ macro_rules! impl_try_from_object_float {
119119
impl_try_from_object_float!(f32, f64);
120120

121121
fn inner_div(v1: f64, v2: f64, vm: &VirtualMachine) -> PyResult<f64> {
122-
float_ops::div(v1, v2).ok_or_else(|| vm.new_zero_division_error("float division by zero"))
122+
float_ops::div(v1, v2).ok_or_else(|| vm.new_zero_division_error("division by zero"))
123123
}
124124

125125
fn inner_mod(v1: f64, v2: f64, vm: &VirtualMachine) -> PyResult<f64> {
126-
float_ops::mod_(v1, v2).ok_or_else(|| vm.new_zero_division_error("float mod by zero"))
126+
float_ops::mod_(v1, v2).ok_or_else(|| vm.new_zero_division_error("division by zero"))
127127
}
128128

129129
pub fn try_to_bigint(value: f64, vm: &VirtualMachine) -> PyResult<BigInt> {
@@ -147,11 +147,11 @@ pub fn try_to_bigint(value: f64, vm: &VirtualMachine) -> PyResult<BigInt> {
147147
}
148148

149149
fn inner_floordiv(v1: f64, v2: f64, vm: &VirtualMachine) -> PyResult<f64> {
150-
float_ops::floordiv(v1, v2).ok_or_else(|| vm.new_zero_division_error("float floordiv by zero"))
150+
float_ops::floordiv(v1, v2).ok_or_else(|| vm.new_zero_division_error("division by zero"))
151151
}
152152

153153
fn inner_divmod(v1: f64, v2: f64, vm: &VirtualMachine) -> PyResult<(f64, f64)> {
154-
float_ops::divmod(v1, v2).ok_or_else(|| vm.new_zero_division_error("float divmod()"))
154+
float_ops::divmod(v1, v2).ok_or_else(|| vm.new_zero_division_error("division by zero"))
155155
}
156156

157157
pub fn float_pow(v1: f64, v2: f64, vm: &VirtualMachine) -> PyResult {

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad © 2024 Your Company Name. All rights reserved.





Check this box to remove all script contents from the fetched content.



Check this box to remove all images from the fetched content.


Check this box to remove all CSS styles from the fetched content.


Check this box to keep images inefficiently compressed and original size.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy