We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
unsafe
1 parent aa03bfc commit a3e3911Copy full SHA for a3e3911
src/validators/decimal.rs
@@ -182,11 +182,7 @@ impl Validator for DecimalValidator {
182
183
if let Some(multiple_of) = &self.multiple_of {
184
// fraction = (decimal / multiple_of) % 1
185
- let fraction = unsafe {
186
- let division = decimal.div(multiple_of)?;
187
- let one = 1u8.into_pyobject(py)?;
188
- Bound::from_owned_ptr_or_err(py, pyo3::ffi::PyNumber_Remainder(division.as_ptr(), one.as_ptr()))?
189
- };
+ let fraction = (decimal.div(multiple_of)?).rem(1)?;
190
let zero = 0u8.into_pyobject(py)?;
191
if !fraction.eq(&zero)? {
192
return Err(ValError::new(
0 commit comments