Update src/conversions/num_bigint.rs

Co-authored-by: David Hewitt <1939362+davidhewitt@users.noreply.github.com>
This commit is contained in:
Jacob Zhong 2022-02-12 10:09:40 -05:00 committed by Jacob Zhong
parent d99a001b7d
commit 9a775c4380

View file

@ -111,7 +111,7 @@ macro_rules! bigint_conversion {
let num: Py<PyLong> =
Py::from_owned_ptr_or_err(py, ffi::PyNumber_Index(ob.as_ptr()))?;
let n_bits = ffi::_PyLong_NumBits(num.as_ptr());
let n_bytes = if n_bits == usize::MAX {
let n_bytes = if n_bits == (-1isize as usize) {
return Err(PyErr::fetch(py));
} else if n_bits == 0 {
0